My current situation is this.
My laravel 5 is here http://domain.com/cms (new project)
My laravel 4 is here http://domain.com/ (old assets)
If I login in http://domain.com/cms and then access the assets from http://domain.com/ (L4) then my cms then will be logged out.
I'm thinking maybe this has something to do with how was the session is being saved, I think they share the same session since they are in the same domain. But that is what I want to solved since they are 2 different project I just need the assets from the L4.
Hope someone can help me!
Thanks!
Chances are you need to change the cookie value in config/session.php (L5) and/or app/config/session.php (L4) to be separate.
Related
I am working on the Laravel project 5.3 and the problem I am facing is when I log in to frontend or the admin Panel another session destroy and logouts the application, need some solution. Both are running on different ports like
example.com
example.com:75/public
example.com:81/public
I am extremely sorry for the bad English and thank you in advance.
User session is stored in the browser cookie, and cookie is related to website domain name. So in your case looks like you use one cookie file for two websites (because it use same name). You can configure virtual host to solve this.
I just changed my .env configuration:
CACHE_DRIVER=file
CACHE_PREFIX=*with_different_name*
SESSION_DRIVER=file
SESSION_COOKIE=*with_different_name_session*
change chache_prefix and session_cookie with different name between your project
it worked for me.
You can connect one of them something like project.local and connect the other with localhost:8000
Just search laravel vhost(virtual host). Thats easy. Good Luck.
I am facing token mismatch issue in new server while working fine in localhost. I have tried every possible way to clear cache and give SESSION_DOMAIN path in env but all seems useless.
Also session cookies are not being created in web browser while creating in storage/framework/session folder.
Please help me !
Are you getting tokenMismatchException exception?
If yes, some of the possible reasons are:
Check your files for PHP end tag "?>", if exists remove it. For more detail refer to this link.
You may need to use web middleware. For more detail refer to this link (although it is about laravel 5.2 but, it may work for your situation too).
Another thing to try is checking for web middleware presence. Normally it should be automatically applied to routes/web.php
Route::group(['middleware' => ['web']], function () {
<routes>
});
Also check out https://laravel.com/docs/5.3/upgrade to see if you have any code that might have been influenced by this update.
And lastly, it would be nice if you could post a piece of code which is responsible for sessions in your app.
I have uploaded my Laravel app unto a directory under the public folder on my domain,
html_docs/public/store
where 'store' is the folder of my Laravel App. My main domain pointed at 'html_docs/public', please check my laravel app here "https://www.dinhi.org/store/". As you can see, when you click the "sell with us" or "login" on the top header, it returns
Not Found
The requested URL /store/dashboard/login was not found on this server.
I have set up to in my '.env' and in my 'config/app.php' the right url like "https://www.dinhi.org/store/" but still not working, any ideas, help please?
PS: I'm on Laravel 5.3 and I'm using Hesto Multi Auth. In my local, this issue does not exist like everything is good and working.
Laravel is not meant to be installed completely into the document root of your server. Actually, every folder of your laravel application except the public folder should be inaccessible from the web.
Your exposing yourself to a security risk here, since everybody could access every file of your app, including potential .env files with database credentials and the likes.
Cheers
Christoph
in my application, after few requests, Laravel sessions randomly expired.
On my site, i had invalid links to images, i repaired them and everything works fine now.
What could be the problem? How could repairing links helped Laravel sessions from not being randomly deleted?
All your routes are inside middleware 'web' ? If you redirect to a route outside 'web' you loose sessions. Check that and return please.
I'm new to Laravel and I am working on an application. I am using sentry to handle users and the login system. But even though my session expiration is set very high, I keep being logged out very frequently, at random times. Is that a laravel problem or maybe an incompatibility with Sentry 2? Any ideas?
You didn't mentioned, but I have to ask, do you have more than one laravel application running on the same server? I've noticed that laravel tends to put the cookie session on the root of the server and if you have two Laravel-based applications running on it with the same location / name (by default, it is called laravel_session), they will overwrite each other.
If that is the case, try going into AppName / app / application / config / session.php and either change the path or the cookie component of the driver. I had trouble changing the path of the session, but if you change the name to, let's say, appName_session instead of laravel_Session it should solve your problem.
Hopefully that is what you meant and that it helps. Good luck.