Nginx redirects a POST request to GET?

26 Views Asked by At

I have a web application developed in Cake PHP 3.9 locally and on a VPS server.

Locally I use WAMP with Apache and it works.

On the VPS, it's NGINX and I notice that in certain cases it immediately redirects a POST request into a GET request. This is problematic because the code does a test like

if ($this->request->is('post')) {

and obviously, as it is no longer POST but GET, it crashes. On the VPS, we only have a PLESK interface and therefore the possibility of adding directives but not of modifying the configuration file.

Do you have any idea on this subject?

At first, I thought it was just 1 line of application code that was causing the problem so I managed to override this error and tinker around a bit.

But when I realized that it was happening in other places, I admit that I had no other idea.

You should know that the code was written for CakePHP 2.x and that we migrated it to 3.9.

0

There are 0 best solutions below