Laravel session ID changes on each request
That means:
- Session driver is not starting up properly
- Client you're using to connect to laravel app server does not accept cookies
- Cookies are set up for wrong domain and/or path.
For case 1 make sure StartSession
middleware exists in app/Kernel.php
at $middlewareGroups
-> web
For case 3 check this answer. In case your app relies on a single domain/path, I recommend you to remove SESSION_DOMAIN
.
Finally, manually remove all sessions from your session driver, then run php artisan config:cache
and try again.
PHP Session Id changes between pages
According to PHP documentation, session_start
must be called before any output is sent back to the browser-- could this page have a rogue CR/LF, Unicode byte-order mark or similar that is causing output before you include('session-inc.php')
?
SessionId keeps changing in every curl request in Spring Boot Application
When you use Chrome to send requests to the server: the server uses cookie as session tracking mechanism to identify your session.
When you use CURL: there is no session tracking mechanism, that's why the server creates a new session for every request.
You can read more about session tracking here: https://javapapers.com/servlet/explain-the-methods-used-for-session-tracking/
Express sessionID changes on every client's request
As Mat J. said, fetch does not send cookies for cross-origin by default, so I had to change it:
fetch(getServerAdress() + "/lobby/" + code, {
method: "GET",
credentials: "include",
}
Also I had to enable credentials and origin for CORS on my server:
const cors = require("cors");
app.use(cors({ credentials: true, origin: true }));
Related Topics
Query With Multiple Values in a Column
How to Change the Background Color of Dropdown List in Select Tag
How to Check If MySQL Results Returned Empty in PHP
How to Remove the Extra Square Bracket from Json Having Multiple Arrays
How to Get Data from Another Table Using Id from Another Table
How to Get Multiple Value from Post Variable Using Same Name
Calculate Size in Bytes of Json Payload Including It in the Json Payload in PHP
How to Resolve a Http 414 "Request Uri Too Long" Error
Extension Mysqli Is Missing, Phpmyadmin Doesn't Work
Laravel PHP Fatal Error: Require(): Failed Opening Required ... Bootstrap/Autoload.Php on Line 17
How to Generate Unique Random Value for Each User in Laravel and Add It to Database
Tell Composer to Use Different PHP Version
The Get Method Is Not Supported for This Route. Supported Methods: Put. But I'M Using Put
Php 7 With Phpmyadmin Gives Lots of Deprecation Notices
Sending Message in Telegram Bot With Images
Reading Numbers as Text Format With Phpexcel
Regex to Check the String Contains Only Letter and Numbers But Not Only Numbers
Get All Hrefs from String But Then Replace Via Another Method