Basically, you want to automatically redirect a POST request using 301 redirects.
However. such redirects are expressly prohibited by the HTTP Specification , which states that:
If the status code 301 is received in response to a request other than GET or HEAD, the user agent SHOULD NOT automatically redirect the request if it cannot be confirmed by the user, as this can change the conditions under which the request was issued.
The specifications also note that:
When automatically redirecting a POST request after receiving a status code 301, some existing HTTP / 1.0 user agents mistakenly change it to a GET request.
I believe that the second situation can happen, and that while the target server is waiting for POST data, it receives GET data.
Your options:
a. Change the code to work with GET data, or better yet, both POST and GET. IE, look for POST, and if not, try GET equivalents.
C. Try to make sure the code receives POST data while working with Spec.
You may be able to achieve selection B using the proxy_pass directive to process the request.
Sort of:
location ~ user_info.php { proxy_pass http://testing.com/userhistory; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }
Thus, the user is not technically redirected.
source share