-
Notifications
You must be signed in to change notification settings - Fork 207
Added custom reverse proxy configurartion. #1200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
5e8a61d
Update advanced/reverse-proxy.mdx
mintlify[bot] 3d41867
Update docs.json
mintlify[bot] eac73e8
Documentation edits made through Mintlify web editor
mintlify[bot] 83b8540
Update advanced/reverse-proxy.mdx
mintlify[bot] 593550f
Update advanced/reverse-proxy.mdx
mintlify[bot] 6c40350
Update advanced/reverse-proxy.mdx
mintlify[bot] 21471de
Documentation edits made through Mintlify web editor
mintlify[bot] dc8d37b
Documentation edits made through Mintlify web editor
mintlify[bot] 41d4dc2
move from `advanced` to `guides`
ethanpalm 88af300
copy edit
ethanpalm aaa3761
remove Custom from title
ethanpalm e35941e
fix group casing
ethanpalm 997d22c
concision
ethanpalm 961daf9
update header
ethanpalm a6fdb4b
replace lists with table
ethanpalm aac35cc
more active language
ethanpalm 5bbcbb8
remove redundant example
ethanpalm 25b11e2
update placeholder
ethanpalm 35404ee
remove propagating snippet
ethanpalm 71e0cb6
copy edit troubleshooting
ethanpalm 9f3126a
make limitations more solutions-oriented
ethanpalm 2182410
update example config
ethanpalm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
--- | ||
title: "Reverse proxy" | ||
description: "Configure a custom reverse proxy to serve your documentation" | ||
--- | ||
|
||
<Note> | ||
Reverse proxy configurations are only supported for [Custom plans](https://mintlify.com/pricing?ref=reverse-proxy). | ||
</Note> | ||
|
||
To serve your documentation through a custom reverse proxy, you must configure routing rules, caching policies, and header forwarding. | ||
|
||
## Routing configuration | ||
|
||
Proxy these paths to your Mintlify subdomain with the specified caching policies: | ||
|
||
| Path | Destination | Caching | | ||
|------|-------------|---------| | ||
| `/.well-known/acme-challenge/*` | `<your-subdomain>.mintlify.app` | No cache | | ||
| `/.well-known/vercel/*` | `<your-subdomain>.mintlify.app` | No cache | | ||
| `/*` | `<your-subdomain>.mintlify.app` | No cache | | ||
| `/` | `<your-subdomain>.mintlify.app` | No cache | | ||
| `/mintlify-assets/_next/static/*` | `<your-subdomain>.mintlify.app/mintlify-assets/_next/static/` | Cache enabled | | ||
|
||
## Required header configuration | ||
|
||
Configure your reverse proxy with these header requirements: | ||
|
||
- **Origin**: Set to `<your-subdomain>.mintlify.app` | ||
- **X-Forwarded-For**: Preserve client IP information | ||
- **X-Forwarded-Proto**: Preserve original protocol (HTTP/HTTPS) | ||
- **X-Real-IP**: Forward the real client IP address | ||
|
||
<Warning> | ||
Ensure that the `Host` header is not forwarded | ||
</Warning> | ||
|
||
## Example nginx configuration | ||
|
||
```nginx | ||
server { | ||
listen 80; | ||
server_name <your-domain>.com; | ||
|
||
# Let's Encrypt and Vercel verification paths | ||
location ~ ^/\.well-known/(acme-challenge|vercel)/ { | ||
proxy_pass https://<your-subdomain>.mintlify.app; | ||
proxy_set_header Origin <your-subdomain>.mintlify.app; | ||
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; | ||
|
||
# Disable caching for verification paths | ||
proxy_cache off; | ||
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.app; | ||
proxy_set_header Origin <your-subdomain>.mintlify.app; | ||
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; | ||
|
||
# Enable caching for static assets | ||
proxy_cache_valid 200 1d; | ||
add_header Cache-Control "public, max-age=86400"; | ||
} | ||
|
||
# All other documentation paths | ||
location / { | ||
proxy_pass https://<your-subdomain>.mintlify.app/; | ||
proxy_set_header Origin <your-subdomain>.mintlify.app; | ||
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; | ||
|
||
# Disable caching for dynamic content | ||
proxy_cache off; | ||
add_header Cache-Control "no-cache, no-store, must-revalidate"; | ||
} | ||
} | ||
``` | ||
|
||
## Common issues and troubleshooting | ||
|
||
### 404 error | ||
|
||
**Symptoms**: Documentation loads but features don't work, API calls fail | ||
|
||
**Cause**: Host header is being forwarded or Origin header is missing | ||
|
||
**Solution**: | ||
|
||
- Remove `Host` header forwarding | ||
- Set `Origin` header to `<your-subdomain>.mintlify.app` | ||
|
||
### Performance issues | ||
|
||
**Symptoms**: Slow page loads and layout shifts. | ||
|
||
**Cause**: Incorrect caching configuration | ||
|
||
**Solution**: Enable caching only for `/mintlify-assets/_next/static/*` paths | ||
|
||
## Support limitations | ||
|
||
<Warning> | ||
Reverse proxy configurations are only supported for [Custom plans](https://mintlify.com/pricing?ref=reverse-proxy). Common issues include: | ||
|
||
- Domain verification failures | ||
- SSL certificate provisioning problems | ||
- Broken authentication flows | ||
- Performance degradation | ||
- Analytics tracking issues | ||
</Warning> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Nginx Config Errors: Missing HTTPS, Inconsistent Slashes
The nginx configuration examples have two issues: the
Origin
header is missing thehttps://
protocol scheme, which can affect CORS validation and other origin-based security checks. Additionally,proxy_pass
URLs show inconsistent trailing slashes, potentially causing unexpected URL rewriting behavior and broken asset paths.