POST requests are not working on production server
Hi all! I moved my application from localhost to dedicated server. On localhost everything was working fine. However, I discovered that I can't login/register on production. Even when I don't fill all required inputs and press submit button, there's no validation, no old() values. To be strict - nothing in code has been changed since I moved app to production.
Just to test what's going on I changed form action in login view to "/test" and when I added route (POST) to "/test", I got 404. However - Route::get for "/test" was working!
When I added
Route::any('/test', function (Request $r) { dd($r); });
after posting through form action I got Request { ... #method: "GET" ... }
One more example - when I POST a request to /password/reset on localhost everything is processing fine, but on production I have MethodNotAllowedHttpException. Once again - in my web.php there's Auth::routes(); line and signup/login feature has been added by php artisan make:auth
Ok guys, I just created fresh laravel project on the same server with php artisan make:auth and I got the same issue! So this is a matter of a Linode server, but I have no idea how. This is URL to fresh laravel project where /login and /register POSTs requests are not working also: http://139.162.219.73
Hello.
It seems to be a problem with the cookie setting in your .env file.
Try adding in your hosts file the ip with the expected host you used for local testing and see if it works
@Fulguletz - I switched SESSION_DRIVER between different ones, but no success. Could you specify your answer about /etc/hosts file? I don't understand which IP should I put there.
@geekatlab - blade views were generated by php artisan make:auth so token is there.
@shez1983 - i forgot to switch it after installation, I changed it but again no success.
I've been struggling with this too and, in my case, the problem was in the html. I had defined the form action as "/users/", changing it to "/users" (without the trailing "/") solved it for me. The only explanation I can think of is that the behavior of the webserver used by vagrant and the one used by my web hosting (Apache), is different in this very particular thing. I hope this helps someone else.