Skip to content

net/http: 301 redirects after a 303 redirect from a POST request don't work #9348

Closed
@conradkleinespel

Description

@conradkleinespel

Hello everyone (reading this) 😃

I'm building a tool that fetches a URL from a POST endpoint, which returns a 303 - See other response with the wanted URL in the Location header. Sometimes this Location itself returns a 301.

Here's the issue: Go seems to process the redirect from the 303 just fine, per line 253 of the source:
http://golang.org/src/net/http/client.go

But once we get to the 301, Go still checks if it should redirect with the function used for POST requests. So it doesn't actually redirect the 301, even though it got there through a GET request (see line 341 of the source).

This seems odd to me. Seems like it could be a bug. Am I missing something? If this is a bug, would a fix for this make sense considering BC?

I'm posting this on behalf of my current employer, shopping24 GmbH.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions