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

Created on 4 Mar 2020  路  9Comments  路  Source: openvinotoolkit/cvat

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.

question

Most helpful comment

@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.*"

All 9 comments

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

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 .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

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 .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

...

I have resolved this by replacing .homeip.net to exact ip of .homeip.net

@amirulmenjeni Hi, is the issue still relevant?

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

I have the same problem; 404 Not Found, nginx 1.18. What should I do?

I tried different workarounds but none of them worked.

image

My docker-compose.override.yml:
image

@ArefAz Hi, what version of CVAT do you use? (git log -1)
Please note since release 0.6.0 host and ports configuration is changed and you need setup only one env variable (CVAT_HOST) for the cvat_proxy container as described here https://github.com/opencv/cvat/blob/master/cvat/apps/documentation/installation.md#advanced-settings. Please follow this guide.

@azhavoro I'm using the latest version.
Screenshot from 2020-05-06 17-05-38

Thanks, I'll try that and will let you know.

@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.*"
Was this page helpful?
0 / 5 - 0 ratings