[BUG] 502 Bad Gateway #4121
Replies: 7 comments 25 replies
-
Hello, do you see the same issue if you use the local IP to access the instance? |
Beta Was this translation helpful? Give feedback.
-
Yes I do, the same 502 Bad Gateway error when trying to go to immich proxy port directly in the browser. The immich proxy log has slightly different error message (only request field is different): 2023/09/17 10:56:04 [error] 41#41: *25 connect() failed (111: Connection refused) while connecting to upstream, client: 172.21.0.1, server: , request: "GET /api HTTP/1.1", upstream: "http://bridge_router_ip:3001/api", host: "my immich domain" |
Beta Was this translation helpful? Give feedback.
-
I converted the issue into a discussion since I don't think this is Immich's bug. What is the docker engine version of your machine? |
Beta Was this translation helpful? Give feedback.
-
I really appreciate the great tips from @jrasm91, thank you very much! Unfortunately I do not posses the required knowledge to solve the issue still. I will be very grateful if you could explain to me how do it. |
Beta Was this translation helpful? Give feedback.
-
I resolved the connection refused messages I think you are seeing, but I'm not sure they are causing the 502's. My issue was that I was using a host name resolved by my router in the nginx proxy config. The problem was that the immich proxy could be entered either with the host ip or the container ip. That can lead to a CSRF error and connection refusd. So I put the nginx server (swag) in the same docker network as the immich proxy and then in my proxy config used the container name for the immich proxy. That will always resolve to the container ip. All the connection refused messages disappeared. |
Beta Was this translation helpful? Give feedback.
-
I managed to fix timeouts and 502 Bad Gateway in immich upload (cli commands) with the following configuration
I know it's overkill but after uploading 20.000 photos and videos I revert it back to normal sizes. |
Beta Was this translation helpful? Give feedback.
-
This still happens regularly when hosting on Unraid. In addition, the docker log for the container repeats an error that immich is unable to read/find a .immich file under the encoded_video path. The file is there, set with the same permissions as every other file/folder in the immich hierarchy. Restarting the full docker stack fixes the issue. No 502 and no errors in log. |
Beta Was this translation helpful? Give feedback.
-
The bug
My Immich server throws 502 Bad Gateway error after running for some time. It works fine after server restart (compose down - compose up or when applying a new update), but after some hours usually the next day, I get the error both on mobile and web (mobile also throws backup error if trying to sync new images). This has been a plague for many months, probably since I started using Immich this year.
When checking immich_proxy logs I see the following error message there:
2023/09/16 17:24:39 [error] 48#48: *47 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: , request: "POST /api/oauth/config HTTP/1.1", upstream: "http://bridge_router_ip:3001/oauth/config", host: "my immich domain"
So I can see that it attempts to connect upstream to a wrong address, the correct one should be 172.18.0.8:3001 as far as I know.
I am using Nginx Proxy Manager, but I don't see any issues in the setup there. I am also using a two router setup: one is connected to internet in the bridge mode (has bridge_router_ip), and the other is servicing the local network while connected to the bridge router for internet.
The OS that Immich Server is running on
Unraid 6.11.5
Version of Immich Server
v1.78.0
Version of Immich Mobile App
v1.78.1 build.102
Platform with the issue
Your docker-compose.yml content
Your .env content
Reproduction steps
Additional information
No response
Beta Was this translation helpful? Give feedback.
All reactions