Session Cookie httponly and secure flag

Session Cookie httponly and secure flag

To secure your website cookies we have to made them secure (over https Chanel).

First check how it looks. Open any page of your website. I am using Firefox with firebug addon. You can use Google chrome as well. In firebug console you will get the URL (Or you can check it in “Net” tab). Expand it and goto Header section. By Default Response Header will open. Now check it out.


We can see the response header doesn’t have any “Set-Cookie” option on it. So we have to add it by our own.

Navigate to your root directory or public html folder. IF you don’t have any “.htaccess” file then create it or if it already exists then add the following line

Header set Set-Cookie HttpOnly;Secure

Now check it again –


Now the parameter has set in our Response header.

Related posts:

Leave a Reply

Your email address will not be published. Required fields are marked *