Allow requests to not follow redirects
bibliotechy opened this issue · comments
We have an API Gateway Resource path that redirects to a pre-signed s3 URL. When I make that request with awscurl
, it errors out with:
The request signature we calculated does not match the signature you provided. Check your key and signing method.
and the pre-signed s3 URL in the python Traceback
...
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://our-bucket-name.s3.amazonaws.com/...
This makes sense because the signed request is not for the final URL. I'm guessing this will happen with any service that responds with a redirect.
I think it would make sense to add support for not following redirects as a command line flag.
It might even make sense to follow the pattern from curl
and only follow redirects if the caller explicitly request it, i.e. curl -L https://my.domain/redirecting
.
Happy to take crack at the implementation I already have a rough working implementation, but want your input in the right approach before I make a PR.
Great! to add comments it needs to be a PR. I have created one and added comments here: https://github.com/okigan/awscurl/pull/118/files#diff-a5f8ec47e2c7e2be1bcf0119f9398660f74f517ea03f556907fd7a5d57ad90fbR326