Axios/XMLHttpRequest is sending GET instead of POST in production environment

后端 未结 3 2080
猫巷女王i
猫巷女王i 2021-01-02 03:22

I am running into a very strange issue. We are putting an app into production and one of the POST request is turning into a POST followed directly by a GET request to the sa

3条回答
  •  没有蜡笔的小新
    2021-01-02 04:00

    This question was also answered by me in the Larachat slack forum, and for others sake here is the answer for the next one with such a problem.

    Just a little back story. In the chat we found out that it was receiving a 301 error which is a redirect error. I had the same error recently when posting to a url on a staging server, it was working fine locally but not on the staging server.

    The problem appeared to be a slash at the end of the post url.

    So posting to https://example.com/post/to/ will not work.

    Removing the / and posting to https://example.com/post/to will work.

提交回复
热议问题