RFC 2616 doesn't specify whether a message-body is needed or not, which I interpret as being optional. Is there any practical danger in omitting a message body?
For example, are there bugs (or features) in certain browsers that are triggered by a blank message body in a 302?
If the HTTP library which you are using does not enable you to control this behavior, you can set an additional header X-If-No-Redirect with a value of 1 . This will prevent our servers from responding with a 302 status code in the case of a redirect.
The HyperText Transfer Protocol (HTTP) 302 Found redirect status response code indicates that the resource requested has been temporarily moved to the URL given by the Location header.
A 302 redirect does not pass the “juice,” or keep your domain authority to its new location. It simply redirects the user to the new location for you so they don't view a broken link, a 404 not found page, or an error page.
It's not needed. The RFC2616 however doesn't forbid it as well. Note that it does forbid the message body for certain statuses, such as 204 and 304. If the same were true for 302, then it should surely have been explicitly mentioned.
As far as I know, all modern browsers ignore the message body of a 302 in response to a GET or POST and will directly go to the URL as specified in Location
header.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With