HTTP icon indicating copy to clipboard operation
HTTP copied to clipboard

HEAD is converted to a GET when following a 302 redirect

Open joeyh opened this issue 13 years ago • 2 comments

I'm using HEAD to check the size of a very large url before downloading it, so it's surprising that when there's a 302 redirect, it's followed using GET.

joeyh avatar Feb 11 '12 01:02 joeyh

Sorry for the delay in looking at this.

On investigation, it turns out that changing requests to a GET is deliberate, and that while 302 is not technically supposed to change the request type, most clients do treat it that way in practice. 307 was apparently created to provide a "proper" temporary URL redirection mechanism.

The behaviour seems mostly intended for reacting to POST and PUT/DELETE requests. I can't see an actual use for turning a HEAD into a GET, so perhaps we should pass HEAD through unchanged?

hsenag avatar May 10 '12 23:05 hsenag

Too bad this still has been unfixed for the last four years. I have the same use-case as joeyh and had a hard time figuring out why HTTP's result is so different from curl's one here. Maybe some programs rely on this redirection behaviour, so I propose adding a browser option to explicitly disable this GET redirection.

pavonia avatar Feb 21 '16 14:02 pavonia