同一容器部署Alertmanager与Unsee及Nginx反向代理故障排查
Hey there! Let’s figure out why your /unsee endpoint is throwing that ERR_INVALID_RESPONSE error—especially since you confirmed Unsee works perfectly when curling http://127.0.0.1:8080. The issue almost certainly lies in how Nginx is proxying requests to Unsee, so let’s break this down step by step.
Common Configuration Fixes to Try
1. Fix Proxy Path Handling
If your Nginx location /unsee block doesn’t handle URI paths correctly, Unsee might get malformed requests it can’t respond to. For example, omitting the trailing slash in proxy_pass makes Nginx pass the /unsee prefix to Unsee, which doesn’t expect it (since Unsee serves content from its own root /).
Use this corrected location block:
location /unsee/ { # Forward requests to Unsee's local port proxy_pass http://127.0.0.1:8080/; # Add critical headers to help Unsee process the request properly proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }
Notice the trailing slash in both location /unsee/ and proxy_pass—this tells Nginx to strip the /unsee prefix when forwarding requests to Unsee, matching how Unsee expects to receive traffic.
2. Check Nginx Error Logs for Clues
Nginx’s error logs will give you specific details about what’s failing. Run this command to view the latest errors in real time:
tail -f /var/log/nginx/error.log
Look for messages like "connection refused" (if Unsee isn’t listening on 127.0.0.1:8080) or "invalid response from upstream" (if Unsee rejects the request format).
3. Verify Unsee’s Binding Address
Double-check that Unsee is configured to listen on 0.0.0.0:8080 or 127.0.0.1:8080. If it’s only bound to a specific container IP that Nginx can’t reach, that would cause a failure. Your curl test to 127.0.0.1:8080 suggests this is probably fine, but it’s worth confirming in Unsee’s config file.
Test Your Changes
After updating your Nginx configuration:
- Validate the config to catch syntax errors:
nginx -t - Reload Nginx to apply the changes:
nginx -s reload - Try accessing
/unseeagain in your browser—this should resolve the ERR_INVALID_RESPONSE error.
内容的提问来源于stack exchange,提问作者Simply Seth

