Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • Hi Daniel, you're wrong about WordPress but sort of right about 302. See my answer to myself. The WP_Http->browser_redirect_compatibility method explicitly enforces this conversion of all requests to GET when redirecting a request with a 302 code. If it weren't for that code in WP, this wouldn't happen when using the HTTP API, at least in my case. Commented Jul 11, 2018 at 18:58
  • Also very relevant is my note that this doesn't affect 301, so the obvious answer isn't to give up on your requests keeping their method when redirecting, but to make sure your web server uses 301 by default and/or when redirecting non-GET pages. Commented Jul 11, 2018 at 18:59
  • My point being, this happens in 99% cases, so I would mostly never expect method to be retained after a redirect. This is even being used for many patterns out there. Sorry it took you years to figure out and two lengthy posts in Stack Exchange to share your experience :) Commented Jul 11, 2018 at 19:02
  • It won't happen if you use 301, as Nginx does in the same situation, where it works. Obviously you're generalizing when you say 99%, but for someone using the HTTP API in WP, this should be a 100% reproducible solution: Use 301 instead and it will work. Commented Jul 11, 2018 at 19:14
  • You're very right. I am generalizing. But if I don't, and go down to your particular problem, I can tell you simply misconfigured your Varnish instance. Proper BAN or PURGE requests should either result in 200 or 405, never a redirect. Should you have fixed it in the server, you wouldn't have WP to blame :) Commented Jul 11, 2018 at 19:21