Skip to main content

Security on Vercel: what to check

Vercel hosts front ends and serverless functions, often for Next.js apps but also for Vite and other static builds. HTTPS and certificates are handled for you.

What remains yours is what your app sends: its headers, its environment variables and the files you publish.

What to check on Vercel

Where settings go on Vercel

Security headers
On Vercel, add it under "headers" in vercel.json for the source "/(.*)".
Secret keys
Variables starting with NEXT_PUBLIC_ are built into the public bundle. Rename the variable without that prefix and use it only in server code: a Route Handler, a Server Action or a server component.

Common questions

Does Vercel set security headers?

Vercel handles HTTPS for you, but headers such as Content-Security-Policy and frame protection are up to you, in vercel.json or your framework.

Are Vercel environment variables secret?

They are stored privately, but a variable your framework builds into the front end, such as one starting NEXT_PUBLIC_ or VITE_, becomes public.