Skip to the content
Start free

Cookies are sent without the Secure flag

Some cookies lack the Secure flag, so a browser may also send them over plain http, where they can be read.

Medium priority Security and HTTPS

Why it matters #

A cookie without Secure can travel over an unencrypted http request, for example when someone types your address without https://. If it is a sign-in or basket cookie, whoever can read that request may be able to use it.

Browsers also require Secure on any cookie marked SameSite=None, and refuse the cookie if it is missing, so features that rely on it may stop working.

How to fix it #

Add Secure to every cookie on an https site. On WordPress the sign-in cookies are secure when the site address is https; other cookies come from plugins, themes or the server, so set the option there.

For a cookie with SameSite=None, add Secure, or use SameSite=Lax if it is not needed on other sites. Check with the Cookie Checker and the Security Headers Checker.

What it looks like, and fixed #

The problem
Set-Cookie: basket_id=abc123; Path=/; HttpOnly

No Secure flag, so the browser may also send this cookie over plain http.

Fixed
Set-Cookie: basket_id=abc123; Path=/; Secure; HttpOnly; SameSite=Lax

Secure keeps it on https only. HttpOnly hides it from scripts, and SameSite=Lax limits when other sites can send it.

Fix it with your AI assistant #

Paste this into ChatGPT, Claude, Gemini or your coding agent. Fill in the words in [square brackets] first. It checks before it changes anything, changes only this, and tells you how to prove it worked.

Your instruction for the AI
Help me secure the cookies on [your website address], built with [your platform, e.g. WordPress with WooCommerce]. A checker says some cookies are set without the Secure flag, so a browser may send them over plain http, and any cookie with SameSite=None but no Secure is refused. First check: run "curl -sI https://[your domain]/" on key pages (or ask me to paste the Set-Cookie lines), and list each cookie with its flags. Say what each is for and what sets it: server, PHP, platform, plugin or script. Explain plainly which ones are at risk. Then give me the exact fix at each source: add Secure to every cookie, keep HttpOnly where it is, and use SameSite=Lax unless a cookie is truly needed on other sites. Rules: back up first, do not rename or delete cookies, and do not change how sign-in, basket or consent work. Give exact code or settings and where they go. Finally, tell me to re-check with the URSY.com Cookie Checker at ursy.com/cookie-checker/.

We find the problems, and help you fix them

  1. Check Run a free tool or the full audit.
  2. Fix it with your AI Download your AI Fix Pack and drop it into ChatGPT, Claude or Gemini. A free account is enough.
  3. Re-check Come back, check again, and watch each fix turn green.

How the AI Fix Pack works, with a sample to download

Fix it on your platform #

WordPress

WordPress sign-in cookies are secure when the site address in Settings, General is https. Other cookies come from plugins or the theme, so look for a secure cookie option there.

Your server or hosting

For PHP sessions set session.cookie_secure = 1 (and session.cookie_httponly = 1) in php.ini, or pass the secure option to setcookie() in the code.

Check it is fixed #

Run the Cookie Checker again: every cookie should show the Secure flag, and none should have SameSite=None without Secure.

Official source #

MDN: Using HTTP cookies

Questions #

Will adding Secure sign people out?

No. Visitors on https keep getting the cookie as before; it is only kept off plain http.

What about cookies set by JavaScript?

Add "; Secure" to the cookie text the script writes. Scripts cannot set HttpOnly, so sensitive cookies are better set by the server.

More problems in Security and HTTPS

See every problem in the library

For AI assistants and developers: Instructions for AI · Developers · How to cite URSY.com