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
Retain safe request method when following redirects #2047
Retain safe request method when following redirects #2047
Conversation
Ran into the same issue (HEAD Request gets a 302 redirect and follows up with a GET Request). |
@Chuvisco88 I'm not a maintainer and so can't merge. Maybe follow this up with @sagikazarmark? |
This looks alright. Thank you @Chuvisco88 for the review. Thank you @webignition for the PR. Can you rebase this on master? |
Yep, can rebase, no problem. I'll do so in about a week when I'm back from vacation. |
Sorry for the long delay. Could you please rebase this PR? |
@Nyholm Apologies also for not getting round to doing so years ago! Rebased now, and as a bonus all the checks are passing 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi.. sorry for the delay.. I was 👍 on this
@Nyholm, we would appreciate if this fix goes into a 6.5 bugfix release one day. We use TYPO3 which has as composer requirement even in current master "guzzlehttp/guzzle: ^6.3.0"... |
TLDR
A solution to #2046, ensures HEAD request method is retained when following 301 redirects.
Overview
RetryMiddleware::modifyRequest()
modifies the method when following 301 redirects. In most cases, the method is changed to GET.Safe methods (GET, HEAD, OPTIONS) can be retained safely when following redirects.
This change ensures that requests issued when following 301 redirects will retain the original request method if that method is safe.