HTTP 307 Temporary Redirect vs 415 Unsupported Media Type
HTTP 307 (Temporary Redirect) is a 3xx Redirection response, while 415 (Unsupported Media Type) is a 4xx Client Error response. 307 indicates that the resource temporarily resides at a different URL. Unlike 302, this guarantees the HTTP method will NOT be changed. In contrast, 415 means that the server refuses to accept the request because the Content-Type is not supported.
Description
The resource temporarily resides at a different URL. Unlike 302, this guarantees the HTTP method will NOT be changed.
When You See It
When you need a temporary redirect that preserves the request method (POST stays POST).
How to Fix
Follow the Location header using the same HTTP method.
Description
The server refuses to accept the request because the Content-Type is not supported.
When You See It
When sending JSON to an endpoint that only accepts XML, or missing the Content-Type header.
How to Fix
Set the correct Content-Type header matching the data format you're sending.
Key Differences
307 is a 3xx Redirection response, while 415 is a 4xx Client Error response.
HTTP 307: The resource temporarily resides at a different URL. Unlike 302, this guarantees the HTTP method will NOT be changed.
HTTP 415: The server refuses to accept the request because the Content-Type is not supported.
You encounter 307 when when you need a temporary redirect that preserves the request method (POST stays POST).
You encounter 415 when when sending JSON to an endpoint that only accepts XML, or missing the Content-Type header.
When to Use Which
For 307 (Temporary Redirect): Follow the Location header using the same HTTP method. For 415 (Unsupported Media Type): Set the correct Content-Type header matching the data format you're sending.