Skip to content

Commit a271b59

Browse files
authored
Change SameSite attribute on session cookies to "lax" (pterodactyl#2592)
1 parent cfaf41c commit a271b59

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

app/Console/Commands/Environment/AppSettingsCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ public function handle()
144144
$this->variables['APP_ENVIRONMENT_ONLY'] = $this->confirm(trans('command/messages.environment.app.settings'), true) ? 'false' : 'true';
145145
}
146146

147+
// Make sure session cookies are set as "secure" when using HTTPS
148+
if (strpos($this->variables['APP_URL'], 'https://') === 0) {
149+
$this->variables['SESSION_SECURE_COOKIE'] = 'true';
150+
}
151+
147152
$this->checkForRedis();
148153
$this->writeToEnvironment($this->variables);
149154

config/session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,5 +188,5 @@
188188
|
189189
*/
190190

191-
'same_site' => null,
191+
'same_site' => env('SESSION_SAMESITE_COOKIE', 'lax'),
192192
];

0 commit comments

Comments
 (0)