cvat: Remote access results in 404 Not Found error (nginx/1.16.1)

I’ve set up and installed cvat on a remote PC connected to a LAN, from which I use my laptop to access cvat remotely. It seems like it’s able to connect to cvat remotely, but there’s no web page found, giving the 404 Not Found error as per the title.

I’ve set up the docker-compose.override.yml file as follows:

version: "2.3"

services:
  cvat:
    environment:
      ALLOWED_HOSTS: "*"
      UI_SCHEME: http
      UI_HOST: 192.168.10.4
    ports:
      - "80:8080"

  cvat_ui:
    build:
      args:
        REACT_APP_API_HOST: 192.168.10.4
        REACT_APP_API_PORT: 8080

The file docker-compose.yml is left as is.

After rebuilding with

docker-compose build

and starting the cvat server with

docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d

the error still persists.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (4 by maintainers)

Most upvoted comments

For version 3.3 only deleting server{…} block from cvat_proxy/conf.d/cvat.conf.template file and restarting solved the issue.

image

@azhavoro Thanks this helped me. I had to use a wildcard though, because cav-ui seems to mix IPs on Client-Side (server and client ips). When I set CVAT_HOST only to the Client IP I will get 404 Errors - I think because the client won’t be able to reach the server IP then (not verified). Nevertheless it does work with wildcard. Using only “*” as wildcard does not work either.

version: "2.3"

services:
  cvat_proxy:
    environment:
      CVAT_HOST: "192.168.178.*"

it seems that you just need to specify CVAT_HOST as the installation guide shows. The method you use is deprecated

Please, follow the docs: https://openvinotoolkit.github.io/cvat/docs/faq/#how-to-change-default-cvat-hostname-or-port

Thanks for your link, I’ve checked but dont understand why it must be the domain instead of localhost (sorry I’m not so good with technology)

@RomanVeretenov This helped. I added ALLOWED_HOST: ‘*’ to environment sections and rebuilt the docker container. Then the login succeeded.

I’m using last develop commit (8afb5dda2a6471ff9274a6ac18c6a425786ddfea) on windows and face following issue:

cvat gui can’t connect cvat database when I’m accessing cvat from outside of our vpn. I have forwarded a port (on homeip.net) and added CVAT_HOST: .homeip.net to docker-compose.yml

Gui is accessible (on <some_name>.homeip.net:38811) but when I connect I see following error message

Could not check authorization on the server Open the Browser Console to get details

Opening the console, I see this message

xhr.js:160 GET http://<some_name>.homeip.net:33881/api/v1/users/self 502 (Bad Gateway)

(anonymous) | @ | xhr.js:160
-- | -- | --
  | e.exports | @ | xhr.js:11
  | e.exports | @ | dispatchRequest.js:57
  | Promise.then (async) |   |  
  | l.request | @ | Axios.js:51
  | r.forEach.l.<computed> | @ | Axios.js:61
  | (anonymous) | @ | bind.js:9
  | getSelf | @ | server-proxy.js:423
  | authorized | @ | server-proxy.js:188
  | e.server.authorized.implementation | @ | api-implementation.js:92
  | apiWrapper | @ | plugins.js:34
  | async function (async) |   |  
  | apiWrapper | @ | plugins.js:17
  | authorized | @ | api.js:192
  | (anonymous) | @ | auth-actions.ts:88
  | (anonymous) | @ | index.js:8
  | verifyAuthorized | @ | index.tsx:87
  | componentDidMount | @ | cvat-app.tsx:60
  | As | @ | react-dom.production.min.js:251
  | t.unstable_runWithPriority | @ | scheduler.production.min.js:18
  | qr | @ | react-dom.production.min.js:120
  | Ds | @ | react-dom.production.min.js:244
  | ws | @ | react-dom.production.min.js:223
  | bs | @ | react-dom.production.min.js:214
  | rc | @ | react-dom.production.min.js:279
  | (anonymous) | @ | react-dom.production.min.js:285
  | ks | @ | react-dom.production.min.js:224
  | uc | @ | react-dom.production.min.js:285
  | render | @ | react-dom.production.min.js:286
  | (anonymous) | @ | index.tsx:107
  | n | @ | bootstrap:19
  | (anonymous) | @ | bootstrap:83
  | (anonymous) | @ | cvat-ui.min.js:1

I have added also ALLOWED_HOST: ‘*’ to all container’s environment section

so my docker-compose is now following:

#
# Copyright (C) 2018-2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
version: "2.3"

services:
  cvat_db:
    container_name: cvat_db
    image: postgres:10-alpine
    networks:
      default:
        aliases:
          - db
    restart: always
    environment:
      POSTGRES_USER: root
      POSTGRES_DB: cvat
      POSTGRES_HOST_AUTH_METHOD: trust
      ALLOWED_HOSTS: '*'
    volumes:
      - cvat_db:/var/lib/postgresql/data

  cvat_redis:
    container_name: cvat_redis
    image: redis:4.0-alpine
    networks:
      default:
        aliases:
          - redis
    restart: always
    environment:
      ALLOWED_HOSTS: '*'

  cvat:
    container_name: cvat
    image: cvat
    restart: always
    depends_on:
      - cvat_redis
      - cvat_db
    build:
      context: .
      args:
        http_proxy:
        https_proxy:
        no_proxy:
        socks_proxy:
        TF_ANNOTATION: "no"
        AUTO_SEGMENTATION: "no"
        USER: "django"
        DJANGO_CONFIGURATION: "production"
        TZ: "Etc/UTC"
        OPENVINO_TOOLKIT: "no"
    environment:
      DJANGO_MODWSGI_EXTRA_ARGS: ""
      ALLOWED_HOSTS: '*'
    volumes:
      - cvat_data:/home/django/data
      - cvat_keys:/home/django/keys
      - cvat_logs:/home/django/logs
      - cvat_models:/home/django/models

  cvat_ui:
    container_name: cvat_ui
    restart: always
    build:
      context: .
      args:
        http_proxy:
        https_proxy:
        no_proxy:
        socks_proxy:
      dockerfile: Dockerfile.ui

    networks:
      default:
        aliases:
          - ui
    depends_on:
      - cvat

  cvat_proxy:
    container_name: cvat_proxy
    image: nginx:stable-alpine
    restart: always
    depends_on:
      - cvat
      - cvat_ui
    environment:
      #CVAT_HOST: 192.168.100.176
      CVAT_HOST: .homeip.net
    ports:
      - "8080:80"
    volumes:
      - ./cvat_proxy/nginx.conf:/etc/nginx/nginx.conf:ro
      - ./cvat_proxy/conf.d/cvat.conf.template:/etc/nginx/conf.d/cvat.conf.template:ro
    command: /bin/sh -c "envsubst '$$CVAT_HOST' < /etc/nginx/conf.d/cvat.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"

volumes:
  cvat_db:
  cvat_data:
  cvat_keys:
  cvat_logs:
  cvat_models:

In cvat’s console, I see following messages

cvat_proxy    | 2020/03/05 11:21:46 [error] 7#7: *21 connect() failed (111: Connection refused) while connecting to upstream, client: 172.28.0.1, server: homeip.net, request: "GET /api/v1/users/self HTTP/1.1", upstream: "http://172.28.0.4:8080/api/v1/users/self", host: "<some_name>.homeip.net:33881", referrer: "http://<some_name>.homeip.net:33881/auth/login"

Another remark is, if I connect the gui while I’m connected to VPN (where the cvat is physically located) and set CVAT_HOST: 192.168.100.176, everything works fine