[BUG] 502 Bad Gateway when trying to access WebUI (Docker)

See original GitHub issue

Hi, I’m trying to install InvenTree since this morning with docker (Unraid Server), On Unraid, we don’t have the docker compose, so I created two dockers, one containing InvenTree and another containing the Nginx, both are in bridge access. InvenTree was installed without too much difficulty however no way to access the web interface, I get a 502 error and the Nginx logs indicate: "[error] 31#31: *2 connect() failed (111: Connection refused) while connecting to upstream"

Concerning the docker :

  • InvenTree image
  • Nginx image

I’ve used the Nginx conf files given on the repo : server { # Listen for connection on (internal) port 80 listen 80; server_name 192.168.0.50; location / { # Change ‘inventree-server’ to the name of the inventree server container, # and ‘8000’ to the INVENTREE_WEB_PORT (if not default) proxy_pass http://192.168.0.50:8181;

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;

    proxy_redirect off;

    client_max_body_size 100M;

    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;

    proxy_buffering off;
    proxy_request_buffering off;

}

# Redirect any requests for static files
location /static/ {
    alias /var/www/static/;
    autoindex on;

    # Caching settings
    expires 30d;
    add_header Pragma public;
    add_header Cache-Control "public";
}

# Redirect any requests for media files
location /media/ {
    alias /var/www/media/;

    # Media files require user authentication
    auth_request /auth;
}

# Use the 'user' API endpoint for auth
location /auth {
    internal;

    proxy_pass http://192.168.0.50:8181/auth/;

    proxy_pass_request_body off;
    proxy_set_header Content-Length "";
    proxy_set_header X-Original-URI $request_uri;
}

}

Logs for the InvenTree Docker Starting :

`"Starting background tasks… Loading action plugins… Discovered 1 action plugins: 13:23:07 [Q] INFO Q Cluster four-east-wisconsin-pennsylvania starting. 13:23:07 [Q] INFO Process-1:1 ready for work at 18 13:23:07 [Q] INFO Process-1:2 ready for work at 19 13:23:07 [Q] INFO Process-1:3 ready for work at 20 13:23:07 [Q] INFO Process-1:4 ready for work at 21 13:23:07 [Q] INFO Process-1:5 monitoring at 22 13:23:07 [Q] INFO Process-1 guarding cluster four-east-wisconsin-pennsylvania 13:23:07 [Q] INFO Q Cluster four-east-wisconsin-pennsylvania running. 13:23:07 [Q] INFO Process-1:6 pushing tasks at 23 13:23:36 [Q] INFO Enqueued 1 13:23:36 [Q] INFO Process-1 created a task from schedule [InvenTree.tasks.delete_successful_tasks] 13:23:36 [Q] INFO Enqueued 2 13:23:36 [Q] INFO Process-1 created a task from schedule [InvenTree.tasks.check_for_updates] 13:23:36 [Q] INFO Enqueued 3 13:23:36 [Q] INFO Process-1 created a task from schedule [InvenTree.tasks.heartbeat] 13:23:36 [Q] INFO Enqueued 4 13:23:36 [Q] INFO Process-1 created a task from schedule [InvenTree.tasks.update_exchange_rates] 13:23:36 [Q] INFO Enqueued 5 13:23:36 [Q] INFO Process-1 created a task from schedule [InvenTree.tasks.delete_expired_sessions] 13:23:36 [Q] INFO Enqueued 6 13:23:36 [Q] INFO Process-1 created a task from schedule [stock.tasks.delete_old_stock_items] 13:23:36 [Q] INFO Process-1:1 processing [grey-dakota-two-hamper] 13:23:36 [Q] INFO Process-1:2 processing [floor-snake-papa-cold] 13:23:36 [Q] INFO Process-1:3 processing [red-floor-louisiana-mississippi] 13:23:36 [Q] INFO Process-1:4 processing [hawaii-sodium-lima-ten] Could not perform heartbeat task - App registry not ready 13:23:36 [Q] INFO Process-1:3 processing [low-music-undress-magnesium] 13:23:36 [Q] INFO Process-1:1 processing [virginia-pennsylvania-seventeen-yankee] Deleting 0 expired sessions. Updating exchange rates from https://api.exchangerate.host/latest Using base currency ‘USD’ 13:23:36 [Q] INFO Processed [red-floor-louisiana-mississippi] 13:23:36 [Q] INFO Processed [grey-dakota-two-hamper] 13:23:36 [Q] INFO Processed [low-music-undress-magnesium] 13:23:36 [Q] INFO Processed [virginia-pennsylvania-seventeen-yankee] Latest InvenTree version: ‘0.5.4’

13:23:37 [Q] INFO Processed [floor-snake-papa-cold] 13:23:37 [Q] INFO Processed [hawaii-sodium-lima-ten] 13:35:08 [Q] INFO Enqueued 7 13:35:08 [Q] INFO Process-1 created a task from schedule [InvenTree.tasks.heartbeat] 13:35:08 [Q] INFO Process-1:3 processing [six-utah-sodium-seven] Could not perform heartbeat task - App registry not ready 13:35:08 [Q] INFO Processed [six-utah-sodium-seven]"`

Deployment Method

  • Docker on Unraid Server

Thanks for Your Help !

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Wystik-69commented, Nov 23, 2021

Yes, I think so 😃 I will try the system tomorrow, I hope it will work like a charm, for now I’m translating InvenTree in French on crowdin because no one has done it lol !

1reaction
Wystik-69commented, Nov 23, 2021

I have a caddy server, I will put the instance behind it, I also have a CloudFlare plan over the Caddy, so I suppose it will be ok, I was just woried about security and stability concerning the docker and if it must run obligatory behind Nginx or not. Many Thanks for your help guys 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error 502 when trying to access to web UI or rpc by ... - GitHub
I have an IP from the VPN provider. When I try to access to the web UI or when I pass by the...
Read more >
502 Bad Gateway when trying to connect to container : r/docker
502 bad gateway means the web front end can't reach its back end / origin server, so you have a connection problem between...
Read more >
502 Bad Gateway - HTTP - MDN Web Docs
The HyperText Transfer Protocol (HTTP) 502 Bad Gateway server error response code indicates that the server, while acting as a gateway or proxy, ......
Read more >
Zigbee2MQTT - Web UI not opening - 502 Bad Gateway
Hi there, I have just installed Zigbee2MQTT. When you look at the logs, everything seems to work just fine. But the Web UI...
Read more >
Traefik > "Bad gateway" (error 502) for some containers
With some containers, it's works like a charm and for other ones, I have an error when I try to access to these...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found