I
Immich3y ago
sonder

Bad gateway (error code 502)

Seems like I'm getting everyone's favorite error. I'm using Nginx Proxy Manager to host immich_proxy outside my network. Here's the most recent error logged on NPM:
2023/02/14 06:15:07 [error] 1446#1446: *41082 upstream sent too big header while reading response header from upstream, client: 172.21.0.1, server: immich.server.io, request: "GET /photos HTTP/2.0", upstream: "http://172.21.0.8:8080/photos", host: "immich.server.io", referrer: "https://npm.server.io/"
2023/02/14 06:15:07 [error] 1446#1446: *41082 upstream sent too big header while reading response header from upstream, client: 172.21.0.1, server: immich.server.io, request: "GET /photos HTTP/2.0", upstream: "http://172.21.0.8:8080/photos", host: "immich.server.io", referrer: "https://npm.server.io/"
Not too sure what to do here. I've tried restarting the stack, but that didn't seem to work. My .env file is standard, with no changes to alternative service addresses.
16 Replies
justjon
justjon3y ago
I also started getting the same error after upgrading. I haven't had a chance to debug properly yet. I see 404 errors in the reverse proxy but haven't checked the endpoints
sonder
sonderOP3y ago
Clearing cookies and any website data for the domain temporarily resolves the problem, up until you close the tab and re-visit the website. Issue promptly occurs when reaching the leading slash /photos of the base domain (https://immich.server.io/photos)
Alex Tran
Alex Tran3y ago
Have you set the client_max_body_size for your setup? Can you post, describe your setup so we can help with troubleshooting?
sonder
sonderOP3y ago
I have not set the client_max_body_size on NPM, however, just doing so does not make a difference. Hopefully I'm not misplacing that. My setup is with the default docker-compose.yml and example.env file. Everything is genuinely untouched. Visiting the web/proxy container through my local IP works just fine and presents no issues, but as soon as I go through a proxy, I encounter error 502.
spupuz | love
spupuz | love3y ago
same error for me clearing cookies does work
justjon
justjon3y ago
All working here. Just opened in private window and then everything worked
Appie
Appie3y ago
Having the same issue here. Deleting cookies is working fine but when you refresh, open another window etc. I get a 502. Fixed it by changing the buffer sizes. Saw there was a difference with the used one and the immich nginx container
Alex Tran
Alex Tran3y ago
This is pretty strange error as we didn’t really change anything regarding proxy in this release
Alex Tran
Alex Tran3y ago
GitHub
[BUG] 502 Bad Gateway after restarting the Browser (Firefox, Gnome ...
The bug Since upgrading to 1.47.2 from 1.46.0 I get a 502 Bad Gateway when I try to open Immich. Deleting Cockies and Website data solves the issue until it appears again. The OS that Immich Server...
Alex Tran
Alex Tran3y ago
This seems to fix this issue Did you guys uodate your proxy recently? And which method did you use to run Immich? (Docker-compose, single Docker file…etc) I am trying to find the root cause of the update
spupuz | love
spupuz | love3y ago
Docker-compose i update proxy with watchtower no specific change in config
Appie
Appie3y ago
Didn't change a thing. This morning I updated the portainer stack by hand. Found the 502 error and started looking for an error. Found the same "2023/02/14 12:27:45 [error] 2822440#2822440: *9613752 upstream sent too big header while reading response header from upstream, ..." error as the BUG report. I fixed it the with the same proxy settings as in 1753.
jrasm91
jrasm913y ago
Thanks for the report - looks like it is an issue with the web framework we are using related to prerendering.
sonder
sonderOP3y ago
Thanks for all your help guys! That did it for me. Increase the proxy_buffer_size in your Nginx config for the time being:
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
Cheers 🎉
danielhep
danielhep3y ago
has anywhere here set up Caddy as a reverse proxy? I am getting a 502 error as well now using Caddy as a reverse proxy. I did play around with the buffer size settings to increase the size but no dice. I am getting a timeout error in the Caddy logs, nothing showing up in the logs for immich_web.
"level":"error","ts":1680210162.8367107,"logger":"http.log.error","msg":"dial tcp 192.168.0.2:2283: i/o timeout"
"level":"error","ts":1680210162.8367107,"logger":"http.log.error","msg":"dial tcp 192.168.0.2:2283: i/o timeout"
jrasm91
jrasm913y ago
Is it running in the same network as immich? Then you should use port 8080.

Did you find this page helpful?