nginx - Use 301 redirect to change the website to a new domain name and POST is lost
PHP中文网2017-05-16 17:13:58
0
3
902
What should I do if using 301 redirection to change the website to a new domain name and get is effective, but post will become invalid and become get?
For the 301 response, the browser’s behavior is to send the URL in the GET request Location. If you need to keep the original POST method unchanged and re-request, you need to use 307, but this may not be what you want, because according to standard browsers, POST requests for 307 require explicit confirmation from the user (for example, an alert will pop up). For detailed explanation, please refer to the following two articles:
Thanks for the invitation.
The current method I can think of is in DNS
New domain name cname Old domain name
Old domain name A record Server IP
It may not be very appropriate, I hope it helps.
Post will be ok if you change it to a relative domain name.
For the 301 response, the browser’s behavior is to send the URL in the GET request Location.
If you need to keep the original POST method unchanged and re-request, you need to use 307, but this may not be what you want, because according to standard browsers, POST requests for 307 require explicit confirmation from the user (for example, an alert will pop up).
For detailed explanation, please refer to the following two articles:
http://www.alanflavell.org.uk...
http://programmers.stackexcha...