Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for following redirects #49

Open
jhalterman opened this issue Apr 13, 2023 · 2 comments
Open

Add support for following redirects #49

jhalterman opened this issue Apr 13, 2023 · 2 comments

Comments

@jhalterman
Copy link

jhalterman commented Apr 13, 2023

We have a scenario where it would be nice if the Bucket client could follow redirects from object storage backends, specifically, 302 responses. This comes into play if someone is running a reverse proxy that forwards http->https, for example, in front of minio. But it also comes up if you're using GCS, which can return 302 responses.

Would you be open to adding support for following redirects? If so I can submit a PR, but I could use some guidance on where the best place to add this config should be since it looks like the different providers have their own configs. exthttp.HTTPConfig seems like a good place, but it looks like that's only used by S3 and Azure. I'd also be interested to see if you have any thoughts on when redirects should be allowed. My thinking is we may only want to follow redirects for GET and HEAD requests.

@matej-g
Copy link
Contributor

matej-g commented Apr 19, 2023

Hey @jhalterman, thanks for opening this up, the requirement and proposal sounds reasonable to me. Would you like to take a stab at this? Although I'm also not sure what would be the best place to add this if we want to make this possible for all providers in a uniform fashion.

@jhalterman
Copy link
Author

I'm good to take a stab if I can get something working relatively quickly since this would be nice to have, but not a huge priority for me. I started working on a PR, and was looking at S3 in particular, but quickly realized that we'd need to temporarily either swap out the bucket client's URL or the bucket client itself in order to follow the redirect, which gets into awkward territory.

One other thing worth noting in case anyone picks this up at some point: we'd need to guard against redirect loops. The simplest solution is to have a max number of redirects, ex: 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants