I'm using Laravel Forge with Akamai/Linode (Ubuntu with nginx) to deploy an app built with Laravel.
On my local development environment (which runs Apache), all is good and things run smoothly.
When deploying on the production server, the POST requests to the API get redirected to a GET request to the homepage.
The webserver has a SSL cert from LetsEncrypt (I've read somewhere that it may cause issues). Some other answers on StackOverflow mention that the requests should have/not have a trailing slash. Tried all possible combinations.
With Postman(and any other testing tool out there), POST to the following API endpoint
https://app.mydomain.com/api/import/app/orders
results in a HTML response from a 302 Redirect response
<body>
Redirecting to <a href="https://app.mydomain.com">https://app.mydomain.com</a>.
</body>
Following that redirect the request gets turned from a POST to a GET. While I understand that the decision of switching the request type might be in the user agent's hands, it's still puzzling how come the redirection happens.
54.86.50.139 - - [18/Jul/2023:10:41:32 +0000]
"POST /api/import/app/orders/ HTTP/1.1"
301 162 "https://app.mydomain.com/api/import/app/orders/"
"PostmanRuntime/7.32.3"
Since I don't have much experience with nginx, I've tried to look into the configuration of it.
I would have expected things to work out of the box on a Laravel Forge configuration.
https://app.mydomain.com/api/test, and you just doreturn "hi, it works!";, does it work at least?/api/testroute. The GET request gets through correctly, the POST request gets redirected to homepage with a GET request.api.phpfile andHttp/Kernel.php