Restrict access to production source maps
Protected Source Maps are available on all plans
Protected Source Maps gates requests for browser source maps behind Vercel Authentication. When enabled, your deployment serves .map files only to users who can already access the deployment, and returns 404 Not Found to everyone else.
This lets you ship source maps to production so your team and error trackers can read meaningful stack traces, without exposing your source code to the public.
To get started, enable Protected Source Maps from your project's Deployment Protection settings, then use the Vercel Toolbar to view protected source maps in your browser.
You can manage Protected Source Maps from the dashboard or the REST API. Either way, access is limited to the users listed below.
The same users who can view your protected deployments can view their source maps:
- Logged-in team members with at least a viewer role
- Logged-in project members with at least the project Viewer role
- Logged-in members of an access group that has access to the project
- Users who have been granted access to the deployment
- Tools using the protection bypass for automation header
From your Vercel dashboard:
- Select the project you want to configure
- Open Settings in the sidebar and select Deployment Protection
From the Protected Source Maps section:
- Use the toggle to enable or disable the feature
- Select Save
The change applies to your existing deployments on the next request for a
.mapfile. There is no need to redeploy.
Use the Vercel API endpoint to update an existing project with the protectedSourcemaps boolean field.
| Parameter | Type | Description |
|---|---|---|
protectedSourcemaps | boolean | Set to true to gate .map requests behind Vercel Authentication, or false to disable. |
curl -X PATCH "https://api.vercel.com/v9/projects/your_project_id_here?teamId=your_team_id_here" \
-H "Authorization: Bearer your_access_token_here" \
-H "Content-Type: application/json" \
-d '{"protectedSourcemaps": true}'Set protectedSourcemaps to false in the body to disable the feature.
Browsers do not send your Vercel session with .map requests by default, so DevTools and other tools cannot load protected source maps until they authenticate against the deployment. The Vercel Toolbar signs the browser in for the current deployment.
To view protected source maps in your browser:
- Open the deployment you want to inspect
- Activate the Vercel Toolbar and sign in with an account that has access to the deployment
- Turn on Debug Mode in the Toolbar Menu
- Reload the page
Your browser DevTools resolves minified stack traces using the protected source maps. Access is scoped to the deployment URL it was issued for, and ends when you sign out of Vercel or close the Toolbar session.
Protected Source Maps only authorizes requests made from a browser with a valid Vercel session. Tools that fetch source maps from outside the browser, such as a CI pipeline uploading them to an error tracker, should use the protection bypass for automation header.
| Consideration | Description |
|---|---|
| Plan availability | Available on all plans. |
| Default behavior | Enabled by default for new projects. Existing projects must opt in by turning the setting on. If your build doesn't generate source maps in production, nothing is exposed today. |
| File scope | Applies to browser source map files (.map) served from your deployment. Inline source maps embedded in JavaScript, server-side source maps used by Vercel Functions, and source maps uploaded to third-party error trackers are unaffected. |
| Response when blocked | Unauthorized requests receive 404 Not Found, not 401 or 403. This avoids confirming the file exists at the requested path. |
| Compatibility | Works alongside Vercel Authentication, Password Protection, and Trusted IPs. |
| Session scope | Authentication is tied to the deployment URL. Sessions do not carry over between URLs, even when those URLs point to the same deployment. |
| Disabling | Setting protectedSourcemaps to false makes the deployment's source maps publicly accessible again on the next request. |
When a browser requests a .map file from your deployment, Vercel checks the project's protectedSourcemaps setting before serving the response:
- If
protectedSourcemapsistrue, Vercel checks the request against deployment protection and serves the source map to authorized users. Everyone else receives a404 Not Foundresponse, which avoids confirming whether the file exists at the requested path. - If
protectedSourcemapsisfalse, the deployment serves source maps to anyone who requests them. This preserves the behavior of projects that intentionally publish source maps for public error tracking.
This protection applies to browser source maps generated during a build, such as *.js.map and *.css.map. It does not change how source maps are generated, uploaded to error trackers, or consumed in non-browser contexts.
Was this helpful?