Files
mintlify__docs/deploy/reverse-proxy.mdx
mintlify[bot] 3ca550b188 Update from code changes: switch hosted docs domain to mintlify.site (#6296)
* docs: update hosted docs domain to mintlify.site

* docs: complete mintlify.site migration across remaining pages

Updates 45 files that PR 6282 had originally changed but were
reverted by PR 6285 and not re-addressed in this PR:

- snippets/vercel-json-generator.mdx (all 4 locales): rewrite
  destinations now use mintlify.site, consistent with deploy/vercel.mdx
- assistant/use.mdx: example deep-link URLs
- ai/skillmd.mdx: agent card subdomain reference
- guides/assistant-embed.mdx: docsURL code example
- guides/codex.mdx: MCP URL example
- deploy/authentication-setup.mdx: example Mintlify subdomain
- discovery-openapi.json: domain identifier URL descriptions (4 occurrences)
- integrations/privacy/osano.mdx: managed rule domain
- editor/branching-and-publishing.mdx: branch preview URL format
- customize/themes.mdx: theme demo site links
- guides/help-center.mdx: live example link
- zh/editor/collaborate.mdx: branch preview URL format

All changes mirrored across es, fr, and zh locales.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 10:51:54 -07:00

408 lines
17 KiB
Plaintext

---
title: "Reverse proxy"
description: "Configure a custom reverse proxy with Nginx, Apache, or Caddy to serve your Mintlify documentation at a subpath on your own domain."
keywords: ["reverse proxy configuration","nginx","proxy routing","header forwarding"]
---
To serve your documentation through a custom reverse proxy, you must configure routing rules, caching policies, and header forwarding.
When you implement a reverse proxy, monitor for potential issues with domain verification, SSL certificate provisioning, authentication flows, performance, and analytics tracking.
## Choose your deployment approach
Mintlify supports two reverse proxy configurations depending on your subpath requirements.
- **Host at `/docs`**: Enable the **Host at `/docs`** toggle on the [Custom domain setup](https://app.mintlify.com/settings/deployment/custom-domain) page in your dashboard. This is a simpler configuration with fewer routes.
- **Custom subpath**: Use any subpath you choose. This approach requires additional routing rules.
In both configurations, use `mintlify.site` as the proxy target.
## Host at `/docs` subpath
Use this configuration when you want to serve documentation at the `/docs` path on your domain.
Before configuring your reverse proxy:
1. Navigate to [Custom domain setup](https://app.mintlify.com/settings/deployment/custom-domain) in your dashboard.
2. Enable the **Host at `/docs`** toggle.
3. Enter your domain and click **Add domain**.
<Warning>
When you enable **Host at `/docs`**, your canonical docs URL becomes `<your-subdomain>.mintlify.site/docs`. Proxy to `<your-subdomain>.mintlify.site` so cache invalidation and updates take effect.
</Warning>
### Routing configuration
Proxy these paths to your Mintlify subdomain:
| Path | Destination | Caching |
| --------------------------------- | ------------------------------------ | -------- |
| `/docs` | `<your-subdomain>.mintlify.site/docs` | No cache |
| `/docs/*` | `<your-subdomain>.mintlify.site/docs` | No cache |
| `/.well-known/vercel/*` | `<your-subdomain>.mintlify.site` | No cache |
| `/.well-known/skills/*` (optional) | `<your-subdomain>.mintlify.site/docs` | No cache |
| `/.well-known/agent-skills/*` (optional) | `<your-subdomain>.mintlify.site/docs` | No cache |
| `/skill.md` (optional) | `<your-subdomain>.mintlify.site/docs` | No cache |
| `/llms.txt` (optional) | `<your-subdomain>.mintlify.site/docs` | No cache |
| `/llms-full.txt` (optional) | `<your-subdomain>.mintlify.site/docs` | No cache |
The `/.well-known/skills/*`, `/.well-known/agent-skills/*`, `/skill.md`, `/llms.txt`, and `/llms-full.txt` routes are optional. Include them only if you want to serve AI files at root paths like `your-domain.com/llms.txt` instead of under your docs subpath like `your-domain.com/docs/llms.txt`.
### Required header configuration
Configure your reverse proxy with these header requirements:
- **Origin**: Contains the target subdomain `<your-subdomain>.mintlify.site`
- **X-Forwarded-For**: Preserves client IP information
- **X-Forwarded-Proto**: Preserves original protocol (HTTP/HTTPS)
- **X-Real-IP**: Forwards the real client IP address
- **User-Agent**: Forwards the user agent
<Warning>
Ensure that the `Host` header is not forwarded.
</Warning>
### Example nginx configuration
```nginx
server {
listen 80;
server_name <your-domain>.com;
# Vercel verification paths
location ~ ^/\.well-known/vercel/ {
proxy_pass https://<your-subdomain>.mintlify.site;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# AI skills paths
location ^~ /.well-known/skills/ {
proxy_pass https://<your-subdomain>.mintlify.site/docs;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# Agent-skills discovery paths
location ^~ /.well-known/agent-skills/ {
proxy_pass https://<your-subdomain>.mintlify.site/docs;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# Skill manifest (optional)
location = /skill.md {
proxy_pass https://<your-subdomain>.mintlify.site/docs;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# LLM index files (optional)
location = /llms.txt {
proxy_pass https://<your-subdomain>.mintlify.site/docs;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
location = /llms-full.txt {
proxy_pass https://<your-subdomain>.mintlify.site/docs;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# Documentation root
location = /docs {
proxy_pass https://<your-subdomain>.mintlify.site/docs;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# All documentation paths
location /docs/ {
proxy_pass https://<your-subdomain>.mintlify.site/docs/;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
}
```
## Custom subpath
<Note>
Reverse proxy configurations for custom subpaths are only supported for [Enterprise plans](https://mintlify.com/pricing?ref=reverse-proxy).
</Note>
When you need a subpath other than `/docs` (such as `/help` or `/resources`), use the following routing configuration.
Proxy these paths to your Mintlify subdomain with the specified caching policies:
| Path | Destination | Caching |
| --------------------------------- | ------------------------------- | ------------- |
| `/.well-known/vercel/*` | `<your-subdomain>.mintlify.site` | No cache |
| `/.well-known/skills/*` | `<your-subdomain>.mintlify.site` | No cache |
| `/.well-known/agent-skills/*` | `<your-subdomain>.mintlify.site` | No cache |
| `/skill.md` | `<your-subdomain>.mintlify.site` | No cache |
| `/llms.txt` | `<your-subdomain>.mintlify.site` | No cache |
| `/llms-full.txt` | `<your-subdomain>.mintlify.site` | No cache |
| `/mintlify-assets/_next/static/*` | `<your-subdomain>.mintlify.site` | Cache enabled |
| `/_mintlify/*` | `<your-subdomain>.mintlify.site` | No cache |
| `/*` | `<your-subdomain>.mintlify.site` | No cache |
| `/` | `<your-subdomain>.mintlify.site` | No cache |
<Note>
Mintlify serves `llms.txt`, `llms-full.txt`, and `skill.md` at the root path. If your docs live under a subpath (such as `/help`), you can also serve these files under that subpath (for example, `/help/llms.txt`). To do this, add location blocks that rewrite the subpath to the root path. See the nginx example below for both patterns.
</Note>
### Required header configuration
Configure your reverse proxy with these header requirements:
- **Origin**: Contains the target subdomain `<your-subdomain>.mintlify.site`
- **X-Forwarded-For**: Preserves client IP information
- **X-Forwarded-Proto**: Preserves original protocol (HTTP/HTTPS)
- **X-Real-IP**: Forwards the real client IP address
- **User-Agent**: Forwards the user agent
<Warning>
Ensure that the `Host` header is not forwarded
</Warning>
### Example nginx configuration
```nginx
server {
listen 80;
server_name <your-domain>.com;
# Vercel verification paths
location ~ ^/\.well-known/vercel/ {
proxy_pass https://<your-subdomain>.mintlify.site;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
# Disable caching for verification paths
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# AI skills paths
location ^~ /.well-known/skills/ {
proxy_pass https://<your-subdomain>.mintlify.site;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
# Disable caching for verification paths
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# Agent-skills discovery paths
location ^~ /.well-known/agent-skills/ {
proxy_pass https://<your-subdomain>.mintlify.site;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
# Disable caching for agent-skills paths
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# Skill manifest
location = /skill.md {
proxy_pass https://<your-subdomain>.mintlify.site;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
# Disable caching for skill manifest
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# LLM index files
location = /llms.txt {
proxy_pass https://<your-subdomain>.mintlify.site;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
location = /llms-full.txt {
proxy_pass https://<your-subdomain>.mintlify.site;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# Optional: Serve AI files under your subpath with path rewriting.
# Replace "/help" with your subpath. These blocks rewrite the
# subpath so Mintlify receives the root path it expects.
#
# location = /help/llms.txt {
# proxy_pass https://<your-subdomain>.mintlify.site/llms.txt;
# proxy_set_header Origin <your-subdomain>.mintlify.site;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
# proxy_set_header User-Agent $http_user_agent;
# add_header Cache-Control "no-cache, no-store, must-revalidate";
# }
#
# location = /help/llms-full.txt {
# proxy_pass https://<your-subdomain>.mintlify.site/llms-full.txt;
# proxy_set_header Origin <your-subdomain>.mintlify.site;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
# proxy_set_header User-Agent $http_user_agent;
# add_header Cache-Control "no-cache, no-store, must-revalidate";
# }
#
# location = /help/skill.md {
# proxy_pass https://<your-subdomain>.mintlify.site/skill.md;
# proxy_set_header Origin <your-subdomain>.mintlify.site;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
# proxy_set_header User-Agent $http_user_agent;
# add_header Cache-Control "no-cache, no-store, must-revalidate";
# }
# Static assets with caching
location ~ ^/mintlify-assets/_next/static/ {
proxy_pass https://<your-subdomain>.mintlify.site;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
# Enable caching for static assets
add_header Cache-Control "public, max-age=86400";
}
# Mintlify-specific paths
location ~ ^/_mintlify/ {
proxy_pass https://<your-subdomain>.mintlify.site;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
# Disable caching for Mintlify paths
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# Root path
location = / {
proxy_pass https://<your-subdomain>.mintlify.site;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
# Disable caching for dynamic content
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# All other documentation paths
location / {
proxy_pass https://<your-subdomain>.mintlify.site;
proxy_set_header Origin <your-subdomain>.mintlify.site;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header User-Agent $http_user_agent;
# Disable caching for dynamic content
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
}
```
## Troubleshooting
### Changes not appearing
**Symptoms**: You publish documentation updates, but the changes don't appear on your site.
**Cause**: Your reverse proxy points to an outdated hostname.
**Solution**: Update your reverse proxy configuration to point to `<your-subdomain>.mintlify.site`.
### 404 error
**Symptoms**: Documentation loads, but features don't work. API calls fail.
**Cause**: The reverse proxy forwards the `Host` header or the `Origin` header is missing.
**Solution**:
- Remove `Host` header forwarding
- Set the `Origin` header to your Mintlify subdomain (`<your-subdomain>.mintlify.site`)
### Performance issues
**Symptoms**: Slow page loads and layout shifts.
**Cause**: Incorrect caching configuration.
**Solution**: For custom subpath configurations, enable caching only for `/mintlify-assets/_next/static/*` paths. The `/docs` subpath configuration handles caching automatically.