แต่เดิมๆ ทำ HTTP Redirect ที่ Apache ด้วย

แต่เดิมๆ ทำ HTTP Redirect ที่ Apache ด้วย

RedirectMatch /(.*) http:///$1

ซึ่งเหมือนมันจะส่ง HTTP 302 ให้ redirect

แต่พบว่า HTTP POST parameters อะไรหายหมด

ค้นหาดูได้ความว่าให้ใช้ 307 แทน ใส่ใน config ยังงี้

Redirect 307 / http:///

คำอธิบายจาก
http://stackoverflow.com/questions/2068418/whats-the-difference-between-a-302-and-a-307-redirect

307 came about because user agents adopted as a de facto behaviour to take POST requests that receive a 302 response and send a GET request to the Location response header.

That is the incorrect behaviour — only a 303 should cause a POST to turn into a GET. User agents should (but don’t) stick with the POST method when requesting the new URL if the original POST request returned a 302.

307 was introduced to allow servers to make it clear to the user agent that a method change should not be made by the client when following the Location response header.

http://stackoverflow.com/questions/2068418/whats-the-difference-between-a-302-and-a-307-redirect

Leave a comment