HTTP 308 Permanent Redirect vs 502 Bad Gateway
HTTP 308 (Permanent Redirect) is a 3xx Redirection response, while 502 (Bad Gateway) is a 5xx Server Error response. 308 indicates that the resource has been permanently moved. Like 301, but guarantees the HTTP method will NOT be changed. In contrast, 502 means that the server, acting as a gateway or proxy, received an invalid response from the upstream server.
Description
The resource has been permanently moved. Like 301, but guarantees the HTTP method will NOT be changed.
When You See It
For permanent URL changes where POST requests must remain POST.
How to Fix
Update all references to the new URL. The HTTP method is preserved.
Description
The server, acting as a gateway or proxy, received an invalid response from the upstream server.
When You See It
When Nginx/Apache can't reach the application server (e.g., Gunicorn is down, upstream timeout).
How to Fix
Check if the upstream server is running. Verify proxy configuration. Check for upstream timeouts.
Key Differences
308 is a 3xx Redirection response, while 502 is a 5xx Server Error response.
HTTP 308: The resource has been permanently moved. Like 301, but guarantees the HTTP method will NOT be changed.
HTTP 502: The server, acting as a gateway or proxy, received an invalid response from the upstream server.
You encounter 308 when for permanent URL changes where POST requests must remain POST.
You encounter 502 when when Nginx/Apache can't reach the application server (e.g., Gunicorn is down, upstream timeout).
When to Use Which
For 308 (Permanent Redirect): Update all references to the new URL. The HTTP method is preserved. For 502 (Bad Gateway): Check if the upstream server is running. Verify proxy configuration. Check for upstream timeouts.