cvat-ai / cvat

Annotate better with CVAT, the industry-leading data engine for machine learning. Used and trusted by teams at any scale, for data of any scale.
https://cvat.ai
MIT License
12.61k stars 3.01k forks source link

Remote access results in 404 Not Found error (nginx/1.16.1) #1231

Closed amirulmenjeni closed 4 years ago

amirulmenjeni commented 4 years ago

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.

yxftju commented 4 years ago

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

RomanVeretenov commented 4 years ago

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

RomanVeretenov commented 4 years ago

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

azhavoro commented 4 years ago

@amirulmenjeni Hi, is the issue still relevant?

yyc9268 commented 4 years ago

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

ArefAz commented 4 years ago

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

azhavoro commented 4 years ago

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

ArefAz commented 4 years ago

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

tomalbrecht commented 4 years ago

@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.*"
emrahustun commented 3 years ago

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

image

longtth commented 3 years ago

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

image

I've just clone cvat from github, and I can't find the cvat_proxy folder, can you please show me where is it? I'm facing 404 error from outside too.

I've tried to search cvat.conf.template file in folder but not found

dps-s2@DPS-S2:~/cvat$ find *conf*
lint-staged.config.js
mod_wsgi.conf
supervisord.conf
midiya commented 3 years ago

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

I've just clone cvat from github, and I can't find the cvat_proxy folder, can you please show me where is it? I'm facing 404 error from outside too.

I've tried to search cvat.conf.template file in folder but not found

dps-s2@DPS-S2:~/cvat$ find *conf*
lint-staged.config.js
mod_wsgi.conf
supervisord.conf

me to . I didnt find that file...

longtth commented 3 years ago

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

I've just clone cvat from github, and I can't find the cvat_proxy folder, can you please show me where is it? I'm facing 404 error from outside too. I've tried to search cvat.conf.template file in folder but not found

dps-s2@DPS-S2:~/cvat$ find *conf*
lint-staged.config.js
mod_wsgi.conf
supervisord.conf

me to . I didnt find that file...

Updated: I fixed the problem my self by update all CVAT_HOST value from localhost to my domain.

azhavoro commented 3 years ago

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

longtth commented 3 years ago

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)

jlcd commented 2 years ago

Same issue here.

Version:

commit f915385f2c7c10b7004aee55d524f37514658c43 (HEAD -> develop, origin/develop, origin/HEAD)
Author: AmitN1212 <69145846+AmitN1212@users.noreply.github.com>
Date:   Fri Dec 31 07:08:00 2021 +0200

    Update documentation (Development Environment section) (#4082)

Windows 10 with WSL2, I followed this quick start guide: https://openvinotoolkit.github.io/cvat/docs/administration/basics/installation/

And got 404 when going to localhost:8080. Have already tried ALLOWED_HOSTS: '172.24.90.*' but it didn't work.

jlcd commented 2 years ago

Same issue here.

Version:

commit f915385f2c7c10b7004aee55d524f37514658c43 (HEAD -> develop, origin/develop, origin/HEAD)
Author: AmitN1212 <69145846+AmitN1212@users.noreply.github.com>
Date:   Fri Dec 31 07:08:00 2021 +0200

    Update documentation (Development Environment section) (#4082)

Windows 10 with WSL2, I followed this quick start guide: https://openvinotoolkit.github.io/cvat/docs/administration/basics/installation/

And got 404 when going to localhost:8080. Have already tried ALLOWED_HOSTS: '172.24.90.*' but it didn't work.

Finally made it work by setting '--providers.docker.exposedByDefault=true' in the traefik service.

bely66 commented 2 years ago

Same issue here. Version:

commit f915385f2c7c10b7004aee55d524f37514658c43 (HEAD -> develop, origin/develop, origin/HEAD)
Author: AmitN1212 <69145846+AmitN1212@users.noreply.github.com>
Date:   Fri Dec 31 07:08:00 2021 +0200

    Update documentation (Development Environment section) (#4082)

Windows 10 with WSL2, I followed this quick start guide: https://openvinotoolkit.github.io/cvat/docs/administration/basics/installation/ And got 404 when going to localhost:8080. Have already tried ALLOWED_HOSTS: '172.24.90.*' but it didn't work.

Finally made it work by setting '--providers.docker.exposedByDefault=true' in the traefik service.

I did that but still getting 404