laravel breeze doesn't work in production? - laravel

I made my first laravel project using Breeze authentification (laravel 9.2).
Everything is ok in local, I can register and login users.
But unfortunately in production on my server, login form and register form don't work so well !
I made a second laravel project, with only authentification functionnality to check if the problem come from part of my app. But the problem repeats : nice in local, does'nt work in production... I don't understand why.
When I submit my new created user or login with an existing user, the form reloads without performing the action...
I have this 404 error in my network console :
POST https://www.prod-breeze.yannpollet.fr/register [HTTP/2 404 Not Found 411ms]
My route login or register exists of course, created automatically with breeze installation.
I read in some forum that Breeze doesn't support https, but i can't believe it.
Anyone has the same problem or know hot to resolve it ?

Related

Laravel sanctum logout not working even after tokens are deleted

I have tried so many options I could think of or find online, user details are still persisted even after successful deletion of all the tokens!
I am using Laravel sanctum with Vue. The logout function I created works as expected when I use postman to make the request, but this is not the case when I make the request via axios from the browser. The tokens gets deleted quite alright but I still can access protected routes.
I have also tried
Auth::logout()
I have continued to try this using sanctum and web as guard.
Any help will be appreciated.

Laravel (Vapor/Lambda) Issue with Cookies and POST Routes

I've developing an update to an existing Laravel System (currently running Laravel 6 and PHP7.4), that runs on both EC2 and Laravel Vapor Setups, and have run into some very strange issues that only present themselves on Vapor Setups. These issues relate to Cookie Generation Failing and POST Routes being ignored when handling Routes.
Issue #1: Cookies No Longer Being Set
The first issue presents itself immediately upon loading the system up for the first time, no cookies are being saved, even though our .env is configured to do so:
SESSION_DRIVER=cookie
Without Cookies being generated, forms can't be processed and users cannot be marked as authenticated.
The system itself has had no changes made to it in areas that would touch core logic around Cookies, but none are now being generated. If we revert the codebase to the previous release without these changes, the system runs perfectly on the Laravel Vapor Setup, but runs without issue using both version of the code on the EC2 Setup.
Potentially Related: Redirecting users seems to be being done with JavaScript on the problematic Vapor Setup, whilst EC2 and Local Development Environments are managing to do so using headers. This indicates there's an issue somewhere in the code that's being used, but the areas that manage that code, as mentioned a few times, haven't been touched during development.
Issue #2: POST Routes Being Ignored
This might be a run on from the first issue above.
POST Routes are being completely ignored from our web.php file. I've tried submitting forms, I've tried using Insomnia to make requests to them, and have even tried setting up a route that would catch requests to any route that was using the POST method, and in each case they were being completely ignored by the system.
Submitting our login forms leads to a strange error being output:
Call to a member function can() on null (View: /var/task/resources/views/core/main/parts/headermenu.blade.php) (View: /var/task/resources/views/core/main/parts/headermenu.blade.php) (View: /var/task/resources/views/core/main/parts/headermenu.blade.php) (View: /var/task/resources/views/core/main/parts/headermenu.blade.php)
This error is strange because it should only be displayed after a user is authenticated, but submitting any details to the system gets this output, even blank details. I'm not sure how the user ends up on an authenticated page, as the POST route that handled authentication is being ignored, so no authentication logic is ever being run. I can, at least, confirm that the system is able to connect to the database to run verification logic, but the route that does so is never accessed because of this issue.
Honestly, I'm coming up blank on solutions to both of these issues, but they're blocking progress with this feature. Any and all guidance on where to look, or how to resolve the above would be most greatly appreciated.

Why Laravel Sanctum returns always 404

I use Laravel with a Vue SPA. The application runs very well sins a half year.
Now, we need a new instance for further tests. The new instance is on the same server as the dev. I like to continue to use dev and if it works, to deploy with deployer to the test instance. So, the new root is current/public
I deployed the application. The start page (login) works. But then, the csrf request returns a 404.
I changed the .env file to the new domain. I checked it twice.
Then i searched in google for other solutions, no way.
I cleaned cache, routes and config. No better result. I checked the store in the browser. Everything looks ok. The session cookie and als the xsrf token are there.
Is it possible, that the server doesn't accept any header? It's an nginx
Actually I have no Idea to where I have to searcht....

Redirect after login fails in Laravel 5.8

Important
I have tried many answers right here published but no one worked for me.
I have installed a fresh copy of Laravel 5.8 including the scaffolding about authentication with:
php artisan make:auth
After that in my localhost redirecting works fine when the users register with name, email, password, and password confirm.
Nevertheless when I upload it to my shared hosting:
I can:
Access to register form
Register a new user
Redirect to login form
But it fails when:
I try to login in with my email and password it only reloads the window of the browser and stays in the same page (login form)
This is strange for me because:
Works fine in localhost
No errors 500
The network tab only shows a 200 code status
Laravel log is empty
I have tried with:
protected $redirectTo = "home";
But anything happens, only the same behavior
I need to say that:
No roles
No third packages only the basic authetication system
You mention when I upload it to my shared hosting - Laravel requires some setup/installation, simply uploading is not enough. Specifically you need to set permissions on several directories. Without correct permissions, your web server cannot create session files. If it can't create session files, logins will fail - and that's exactly what you are seeing.
Update: fixed Laravel 7 link for Laravel 5.8

Laravel login stuck in loop

I'm having an issue when deploying. When logging into Laravel Nova it just refreshes the login screen over and over again and seems stuck in a loop. whether you enter the wrong or right credentials makes no difference. There are no error messages and reloads the login page.
All working on localhost, and the wrong credentials error message does show up on local if incorrect details entered. Strange issue just generated a server on Forge + DigitalOcean. I don't see what could be the issue.
It's the post form trying to post to http instead of https... if anyone has that issue hope it helped

Resources