How to check if your .env is exposed
One URL check that tells you if your production host is serving your secrets file — and how to fix it.
If https://your-domain/.env returns a file full of KEY=value lines, those secrets are public. Same for /.git/HEAD (which often means the whole git history is downloadable).
Check
- Open
https://YOUR_DOMAIN/.envin a private window. - Open
https://YOUR_DOMAIN/.git/HEAD. A response likeref: refs/heads/mainmeans.gitis exposed. - If either works: rotate every secret in that file before you do anything else.
Fix
- Ensure
.envis in.gitignoreand never copied intopublic/,dist/, orstatic/. - Configure the host/CDN to 404 dotfiles (Vercel/Netlify normally do; raw object storage and some VPS setups do not).
- Redeploy from a clean build.
Copy-paste into your AI builder
Make sure .env and .git can never be served as static files. Add .env to .gitignore. Configure the host to return 404 for paths starting with /. List every secret that must be rotated if .env was ever public.
Related: Hide API keys · service_role
Scan your app free
Paste your URL. ShipLatch checks for leaked keys, exposed /.env and /.git, and flags Supabase/Firebase so you know what to lock down.