Laravel 5.8 419 page expire Exception in Bluehost Server - laravel

i just uploaded a Laravel 5.8 Project in my Bluehost hosting. Every thing is set. When login to the application it is showing 419 Page Expired Exception. I used #csrf and in post request.
in my local machine it is running perfectly. When i purchased domain bluehost provided me wordpress hosting and i removed all wordpress files in the domain and uploaded Laravel Project.

You may make a route like
Route::get('/clear',function(){
Artisan::call('view:clear');
Artisan::call('route:clear');
Artisan::call('config:cache');
Artisan::call('cache:clear');
});
then run from the browser like
http://your-app.com/clear
Hope this may help you. Thanks.

Related

laravel breeze doesn't work in production?

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 ?

Getting 419 page expired error while logging in laravel app

I am trying to login in my laravel app on live server on local it works fine. but on live server it give 419 page expired error. I tried previouse questions answer on Stackoverflow but nothing working.
I tried to find if there is any file which is not starting from <?php
Also I made sure that #csrf token is passed from login form.
It was working fine suddenly start giving this error
this is because you use "HTTP" protocol.use "HTTPS" instead it it should be fine.

Sanctum laravel is working fine on local, not in heroku

I have developed a front (react) and a back (php laravel) with the authentication system "sanctum". All is working fine on localhost. But I can't get it to work in production in heroku.
In local environment ,my .env is (extract) :
SESSION_DRIVER=cookie
SANCTUM_STATEFUL_DOMAINS=localhost:3000,127.0.0.1:3000,localhost:8000,127.0.0.1:8000
SESSION_DOMAIN=localhost
If I have understood well, the front and back must be on the same domains for the cookies. As my back and front are hosted in heroku (herokuapp.com), I have these .env :
But with this configuration, I always have a response 419 CSRF token mismatch.
Certainly my conf is not correct. But I tried a lot of things without success.
edit :
The back url is: https://school-back-v2.herokuapp.com/
The front url is: https://react-protected-routes.herokuapp.com/
Heroku is blacklisted by browsers to use cookie if you site placed on Heroku subdomain. You can use Heroku, but must to register your own domain and use it, so that resolve this problem.
Other variant - use tokens instead cookie.

Laravel basic auth redirects to HTTPS route after login

I added laravel’s built-in authentication to an existing project. This is a local project without certificates.
After login I was redirected to the dashboard page but chrome showed an “ERR_SSL_PROTOCOL_ERROR” message. I looked into it for a couple of hours and I found that the dashboard's page was opening as HTTPS, when I changed the url to HTTP It showed the dashboard page. For some reason the auth’s routes are being redirected to the site as HTTPS.
I'm new to laravel and I don't understand what’s happening.
I did some reverse engineering and found that in my AppServiceProvider were the configurations that redirected my routes to HTTPS.
Load Blade assets with https in Laravel

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

Resources