Deploy at a subpath with Vercel
Serve your Mintlify site at a subpath on your main domain using Vercel rewrites, with a step-by-step vercel.json configuration walkthrough.
Configure your vercel.json file to proxy requests from your main domain to your documentation at a subpath.
The vercel.json file
The vercel.json file configures how your project builds and deploys. It sits in your project’s root directory and controls various aspects of your deployment, including routing, redirects, headers, and build settings.
Mintlify uses the rewrites configuration in your vercel.json file to proxy requests from your main domain to your documentation.
Rewrites map incoming requests to different destinations without changing the URL in the browser. When someone visits yoursite.com/docs, Vercel internally fetches content from your-subdomain.mintlify.site/docs, but the user still sees yoursite.com/docs in their browser. This is different from redirects, which send users to another URL entirely.
Configuration
Host at /docs subpath
The rewrites configuration maps the /docs subpath on your domain to the /docs subpath on your documentation.
The /_mintlify rewrite is required. It serves your site’s CSS, JavaScript, fonts, and API requests from the root of your domain. Without it, pages load without styles. The /mintlify-assets rewrite serves favicons and static assets for some sites. Keep both rewrites at the root of your domain, without your subpath.
For more information, see Configuring projects with vercel.json: Rewrites in the Vercel documentation.
Host at custom subpath
To use a custom subpath (any path other than /docs):
Then use the generator below to create your rewrites configuration and add the rewrites to your vercel.json file.
Mintlify rebuilds your documentation to serve at your base path, so your documentation files do not need to be in a directory that matches your subpath.
External proxies in front of Vercel
If you have an external proxy like Cloudflare or AWS CloudFront in front of your Vercel deployment, configure it properly. This avoids conflicts with Vercel’s domain verification and SSL certificate provisioning.
Improper proxy configuration can prevent Vercel from provisioning Let’s Encrypt SSL certificates and cause domain verification failures.
See the supported providers in the Vercel documentation.
Required path allowlist
Your external proxy must allow traffic to these specific paths without blocking, redirecting, or heavily caching:
Your proxy should pass these paths directly to your Vercel deployment without modification.
Header forwarding requirements
Ensure that your proxy correctly forwards the Host header. Without proper header forwarding, verification requests fail.
Test your proxy setup
To verify your proxy is correctly configured: