POST request turns into GET request

前端 未结 2 1660
鱼传尺愫
鱼传尺愫 2020-12-11 08:25

I have a Rails 4.1 application with nginx and unicorn. Some of POST request are turn into GET request. I gues it\'s related my nginx config. Here is the previous question ab

相关标签:
2条回答
  • 2020-12-11 08:54

    You may also want to try a 307 redirect. I found that my POST's were turning into GET's with the 301 redirect.

    I.e. your server block becomes:

    server {
        server_name www.my-app.com my-app.com;
        return 307 $scheme://$host$request_uri;
    }
    
    0 讨论(0)
  • 2020-12-11 09:00
    server {
     server_name www.my-app.com
     return 301 $scheme://my-app.com$request_uri;
    }
    

    This unconditionally will throw a 301 to every request to www.my-app.com

    If there is no other return 301 in config: Check that the form action (or ajax request) is NOT using www.my-app.com domain, but just my-app.com, so it's not rewrited.

    If there are others 301 in the config (removed for the post) could be something different.

    0 讨论(0)
提交回复
热议问题