Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Deekshith's avatar

Set SSL Cookie without Secure Flag set and Cookie Without HTTPOnly Flag Set

I have received security aduit report and they mentioned like below,

set Cookie Without HTTPOnly Flag Set and SSL Cookie without Secure Flag set how can i do this in laravel 5.6 i have updated in session.php file like below, 'secure' => env('SESSION_SECURE_COOKIE', true), but they said it is not done yet.

0 likes
3 replies
laracoft's avatar

@deekshith

I think they want your site to work on HTTPS only. You can set it in .htaccess or write a middleware to do that.

Deekshith's avatar

@laracoft website already running with https. i have code to redirect all routes to https in htaccess

laracoft's avatar

@deekshith in your config/session.php,

  1. Set 'encrypt' => true
  2. Check that 'http_only' => true, but this is already Laravel's default.

Please or to participate in this conversation.