Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a website set up that uses the redirect method...

server {
    listen 80;
    server_name example.org;
    return 301 https://$server_name$request_uri;
}

However when a page is posted to "http://example.com" it redirects to "https://example.com" and in the process, it strips the POST.

I recognize this is how it works, however I need to somehow do one of the following...

  • Do a redirect from http -> https while keeping the POST variable intact
  • Convert the POST variable to a GET variable during the redirect (which would work fine)
  • Redirect everything EXCEPT for one folder

Any suggestions? I'm a bit lost...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.0k views
Welcome To Ask or Share your Answers For Others

1 Answer

If you are willing to forgo the "permanent" redirect status, I believe a 307 redirect instead of a 301 will preserve the POST. There actually is a redirect that is permanent and preserves the post, a 308, but it isn't well adopted yet by browsers and other user agents.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...