#10 of 10medium

Missing browser protections

Security headers tell the browser how to protect your users: always use HTTPS, don't let other sites frame your pages, and which sites may read your API. Missing headers are rarely the way in on their own, but they make other bugs worse. The fix: add them in your host's config and redirect HTTP to HTTPS.

Where it shows up: Your host's configuration

Are you affected? The 60-second check

Look at the headers your homepage sends:

Terminal
curl -sI https://yourapp.com | grep -iE "strict-transport|content-security|x-frame|access-control|set-cookie" curl -sI http://yourapp.com | head -3

Every protection that's missing from the first output is a header to add. The second command should return a 301 or 308 redirect to https.

What it is

Browsers can protect your users, but only when your site asks them to, through response headers and cookie settings.

Without them your site can be loaded inside another site to trick users into clicks, cookies can travel over plain HTTP, and other sites may be able to make logged-in requests to your API.

What an attacker sees

These are rarely the first way in, but they turn smaller problems into real ones. A CORS setting that allows any site with credentials is the exception: that one can expose logged-in users' data directly.

How to fix it

Paste this into your AI tool:

Paste the prompt below into your vibecoding tool

Add security headers to my deployed app: Strict-Transport-Security, a Content-Security-Policy, and frame protection (frame-ancestors or X-Frame-Options). Make sure HTTP redirects to HTTPS, cookies are Secure, HttpOnly and SameSite, and CORS never allows any origin together with credentials.

vercel.json
{ "headers": [ { "source": "/(.*)", "headers": [ { "key": "Strict-Transport-Security", "value": "max-age=63072000; includeSubDomains" }, { "key": "X-Frame-Options", "value": "DENY" }, { "key": "X-Content-Type-Options", "value": "nosniff" }, { "key": "Referrer-Policy", "value": "strict-origin-when-cross-origin" } ] } ] }

Or by hand:

  1. Add the headers in your host's config (for example vercel.json, netlify.toml or your server).
  2. Fix CORS first if it allows any origin with credentials.
  3. Redeploy and re-scan.

Vercel (v0, Next.js)

Add a headers block to vercel.json (example above), or a headers() function in next.config.

Netlify

Add a _headers file to your publish folder, or a [[headers]] section in netlify.toml.

Content-Security-Policy

Add it last. Start with Content-Security-Policy-Report-Only, watch what it would block, then switch to enforcing.

Mistakes that look fixed but aren't

  • A CORS setup that echoes back any Origin while allowing credentials. That lets any website read logged-in users' data from your API.
  • A Content-Security-Policy with unsafe-inline, unsafe-eval and * in it, which looks present but blocks almost nothing.
  • Session cookies without Secure, HttpOnly and SameSite.

Check your app

Shippable reads the headers and cookies on your homepage and checks that plain HTTP redirects to HTTPS. It covers HSTS, Content-Security-Policy, clickjacking protection, CORS and cookie flags.

This check depends on your host, so scan your deployed app:

Terminal
npx shippable-dev scan https://yourapp.com

Or scan your live app in the browser:

FAQ

Which header matters most?

Fix CORS first if it allows any origin with credentials, since that one can expose data directly. Then HTTPS with HSTS, then frame protection.

Will adding headers break my app?

HSTS and frame protection rarely do. A Content-Security-Policy often will at first, which is why it should start in report-only mode.