mirror of
https://github.com/mintlify/docs.git
synced 2026-09-14 13:35:46 +08:00
eebe544029
Generated-By: mintlify-agent Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
431 lines
19 KiB
Plaintext
431 lines
19 KiB
Plaintext
---
|
||
title: "Proxy inverse"
|
||
description: "Configurez un proxy inverse personnalisé avec Nginx, Apache ou Caddy pour servir votre documentation Mintlify sur un sous-chemin de votre propre domaine."
|
||
keywords: ["configuration de proxy inverse", "nginx", "routage du proxy", "transmission des en-têtes"]
|
||
---
|
||
|
||
Pour diffuser votre documentation via un proxy inverse personnalisé, vous devez configurer des règles de routage, des stratégies de mise en cache et la transmission des en-têtes.
|
||
|
||
Lorsque vous mettez en place un proxy inverse, surveillez les problèmes potentiels liés à la vérification du domain, à l’émission des certificats SSL, aux parcours d’authentification, aux performances et au suivi Analytics.
|
||
|
||
<div id="choose-your-deployment-approach">
|
||
## Choisissez votre approche de déploiement
|
||
</div>
|
||
|
||
Mintlify prend en charge deux configurations de proxy inverse en fonction de vos exigences en matière de sous-chemin.
|
||
|
||
- **Héberger sur `/docs`** : utilisez `mintlify.dev` comme cible du proxy. Activez le bouton **Héberger sur `/docs`** sur la page [Configuration du domaine personnalisé](https://dashboard.mintlify.com/settings/deployment/custom-domain) de votre Dashboard. Il s’agit d’une configuration plus simple avec moins de routes.
|
||
- **Sous-chemin personnalisé** : utilisez `mintlify.app` comme cible du proxy. Cette approche prend en charge n’importe quel sous-chemin et nécessite des règles de routage supplémentaires.
|
||
|
||
<div id="host-at-docs-subpath">
|
||
## Héberger sur le sous-chemin `/docs`
|
||
</div>
|
||
|
||
Utilisez cette configuration lorsque vous souhaitez servir la documentation sur le chemin `/docs` de votre domaine.
|
||
|
||
Avant de configurer votre reverse proxy :
|
||
|
||
1. Accédez à [Custom domain setup](https://dashboard.mintlify.com/settings/deployment/custom-domain) dans votre Dashboard.
|
||
2. Activez l’option **Host at `/docs`**.
|
||
3. Saisissez votre domaine et sélectionnez **Add domain**.
|
||
|
||
<Warning>
|
||
Lorsque vous activez **Host at `/docs`**, l’URL canonique de votre documentation devient `<your-subdomain>.mintlify.dev`. L’invalidation du cache s’arrête sur `mintlify.app`, et vous devez configurer le proxy vers `mintlify.dev` pour que les mises à jour apparaissent.
|
||
</Warning>
|
||
|
||
<div id="routing-configuration">
|
||
### Configuration du routage
|
||
</div>
|
||
|
||
Redirigez ces chemins via un proxy vers votre sous-domaine Mintlify :
|
||
|
||
| Path | Destination | Caching |
|
||
| --------------------------------- | ------------------------------------ | -------- |
|
||
| `/docs` | `<your-subdomain>.mintlify.dev/docs` | No cache |
|
||
| `/docs/*` | `<your-subdomain>.mintlify.dev/docs` | No cache |
|
||
| `/.well-known/vercel/*` | `<your-subdomain>.mintlify.dev` | No cache |
|
||
| `/.well-known/skills/*` (optional) | `<your-subdomain>.mintlify.dev/docs` | No cache |
|
||
| `/.well-known/agent-skills/*` (optional) | `<your-subdomain>.mintlify.dev/docs` | No cache |
|
||
| `/skill.md` (optional) | `<your-subdomain>.mintlify.dev/docs` | No cache |
|
||
| `/llms.txt` (optional) | `<your-subdomain>.mintlify.dev/docs` | No cache |
|
||
| `/llms-full.txt` (optional) | `<your-subdomain>.mintlify.dev/docs` | No cache |
|
||
|
||
Les routes `/.well-known/skills/*`, `/.well-known/agent-skills/*`, `/skill.md`, `/llms.txt` et `/llms-full.txt` sont facultatives. Ne les incluez que si vous souhaitez servir des fichiers d'IA sur des chemins à la racine comme `your-domain.com/llms.txt` plutôt que sous votre sous-chemin de documentation, par exemple `your-domain.com/docs/llms.txt`.
|
||
|
||
<div id="required-header-configuration">
|
||
### Configuration d’en-têtes requise
|
||
</div>
|
||
|
||
Configurez votre reverse proxy avec les en-têtes suivants :
|
||
|
||
* **Origin** : contient le sous-domaine cible `<your-subdomain>.mintlify.dev`
|
||
* **X-Forwarded-For** : conserve les informations d’adresse IP du client
|
||
* **X-Forwarded-Proto** : conserve le protocole d’origine (HTTP/HTTPS)
|
||
* **X-Real-IP** : transmet la véritable adresse IP du client
|
||
* **User-Agent** : transmet l’agent utilisateur
|
||
|
||
<Warning>
|
||
Assurez-vous que l’en-tête `Host` n’est pas transmis.
|
||
</Warning>
|
||
|
||
<div id="example-nginx-configuration">
|
||
### Exemple de configuration Nginx
|
||
</div>
|
||
|
||
```nginx
|
||
server {
|
||
listen 80;
|
||
server_name <your-domain>.com;
|
||
|
||
# Vercel verification paths
|
||
location ~ ^/\.well-known/vercel/ {
|
||
proxy_pass https://<your-subdomain>.mintlify.dev;
|
||
proxy_set_header Origin <your-subdomain>.mintlify.dev;
|
||
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.dev/docs;
|
||
proxy_set_header Origin <your-subdomain>.mintlify.dev;
|
||
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.dev/docs;
|
||
proxy_set_header Origin <your-subdomain>.mintlify.dev;
|
||
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";
|
||
}
|
||
|
||
# Manifeste de compétence (facultatif)
|
||
location = /skill.md {
|
||
proxy_pass https://<your-subdomain>.mintlify.dev/docs;
|
||
proxy_set_header Origin <your-subdomain>.mintlify.dev;
|
||
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";
|
||
}
|
||
|
||
# Fichiers d'index LLM (facultatif)
|
||
location = /llms.txt {
|
||
proxy_pass https://<your-subdomain>.mintlify.dev/docs;
|
||
proxy_set_header Origin <your-subdomain>.mintlify.dev;
|
||
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.dev/docs;
|
||
proxy_set_header Origin <your-subdomain>.mintlify.dev;
|
||
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.dev/docs;
|
||
proxy_set_header Origin <your-subdomain>.mintlify.dev;
|
||
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.dev/docs/;
|
||
proxy_set_header Origin <your-subdomain>.mintlify.dev;
|
||
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";
|
||
}
|
||
}
|
||
```
|
||
|
||
|
||
<div id="custom-subpath">
|
||
## Sous-chemin personnalisé
|
||
</div>
|
||
|
||
<Note>
|
||
Les configurations de proxy inverse pour les sous-chemins personnalisés ne sont prises en charge que pour les [offres Enterprise](https://mintlify.com/pricing?ref=reverse-proxy).
|
||
</Note>
|
||
|
||
Lorsque vous avez besoin d'un sous-chemin autre que `/docs` (comme `/help` ou `/resources`), utilisez la configuration de routage suivante.
|
||
|
||
Redirigez ces chemins vers votre sous-domaine Mintlify avec les politiques de mise en cache indiquées :
|
||
|
||
| Chemin | Destination | Mise en cache |
|
||
| --------------------------------- | ------------------------------- | ------------- |
|
||
| `/.well-known/vercel/*` | `<your-subdomain>.mintlify.app` | Pas de cache |
|
||
| `/.well-known/skills/*` | `<your-subdomain>.mintlify.app` | Pas de cache |
|
||
| `/.well-known/agent-skills/*` | `<your-subdomain>.mintlify.app` | Pas de cache |
|
||
| `/skill.md` | `<your-subdomain>.mintlify.app` | Pas de cache |
|
||
| `/llms.txt` | `<your-subdomain>.mintlify.app` | Pas de cache |
|
||
| `/llms-full.txt` | `<your-subdomain>.mintlify.app` | Pas de cache |
|
||
| `/mintlify-assets/_next/static/*` | `<your-subdomain>.mintlify.app` | Cache activé |
|
||
| `/_mintlify/*` | `<your-subdomain>.mintlify.app` | Pas de cache |
|
||
| `/*` | `<your-subdomain>.mintlify.app` | Pas de cache |
|
||
| `/` | `<your-subdomain>.mintlify.app` | Pas de cache |
|
||
|
||
<Note>
|
||
Mintlify sert `llms.txt`, `llms-full.txt` et `skill.md` à la racine. Si votre documentation se trouve sous un sous-chemin (comme `/help`), vous pouvez également servir ces fichiers depuis ce sous-chemin (par exemple, `/help/llms.txt`). Pour cela, ajoutez des blocs location qui réécrivent le sous-chemin vers le chemin racine. Consultez l'exemple nginx ci-dessous pour les deux approches.
|
||
</Note>
|
||
|
||
<div id="required-header-configuration">
|
||
### Configuration d'en-têtes requise
|
||
</div>
|
||
|
||
Configurez votre reverse proxy avec les en-têtes suivants :
|
||
|
||
- **Origin** : contient le sous-domaine cible `<your-subdomain>.mintlify.app`
|
||
- **X-Forwarded-For** : conserve les informations d’adresse IP du client
|
||
- **X-Forwarded-Proto** : conserve le protocole d’origine (HTTP/HTTPS)
|
||
- **X-Real-IP** : transmet la véritable adresse IP du client
|
||
- **User-Agent** : transmet l’agent utilisateur
|
||
|
||
<Warning>
|
||
Assurez-vous que l’en-tête `Host` n’est pas transmis
|
||
</Warning>
|
||
|
||
<div id="example-nginx-configuration">
|
||
### Exemple de configuration Nginx
|
||
</div>
|
||
|
||
```nginx
|
||
server {
|
||
listen 80;
|
||
server_name <your-domain>.com;
|
||
|
||
# Vercel verification paths
|
||
location ~ ^/\.well-known/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;
|
||
proxy_set_header User-Agent $http_user_agent;
|
||
|
||
# Désactiver la mise en cache pour les chemins de vérification
|
||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||
}
|
||
|
||
# AI skills paths
|
||
location ^~ /.well-known/skills/ {
|
||
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;
|
||
proxy_set_header User-Agent $http_user_agent;
|
||
|
||
# Désactiver la mise en cache pour les chemins de vérification
|
||
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.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;
|
||
proxy_set_header User-Agent $http_user_agent;
|
||
|
||
# Désactiver la mise en cache pour les chemins agent-skills
|
||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||
}
|
||
|
||
# Skill manifest
|
||
location = /skill.md {
|
||
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;
|
||
proxy_set_header User-Agent $http_user_agent;
|
||
|
||
# Disable caching for skill manifest
|
||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||
}
|
||
|
||
# Fichiers d'index LLM
|
||
location = /llms.txt {
|
||
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;
|
||
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.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;
|
||
proxy_set_header User-Agent $http_user_agent;
|
||
|
||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||
}
|
||
|
||
# Facultatif : Servir les fichiers d'IA sous votre sous-chemin avec réécriture de chemin.
|
||
# Remplacez "/help" par votre sous-chemin. Ces blocs réécrivent le
|
||
# sous-chemin afin que Mintlify reçoive le chemin racine attendu.
|
||
#
|
||
# location = /help/llms.txt {
|
||
# proxy_pass https://<your-subdomain>.mintlify.app/llms.txt;
|
||
# 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;
|
||
# 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.app/llms-full.txt;
|
||
# 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;
|
||
# 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.app/skill.md;
|
||
# 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;
|
||
# 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.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;
|
||
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.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;
|
||
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.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;
|
||
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.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;
|
||
proxy_set_header User-Agent $http_user_agent;
|
||
|
||
# Disable caching for dynamic content
|
||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||
}
|
||
}
|
||
```
|
||
|
||
|
||
<div id="troubleshooting">
|
||
## Résolution des problèmes
|
||
</div>
|
||
|
||
<div id="changes-not-appearing">
|
||
### Les modifications n'apparaissent pas
|
||
</div>
|
||
|
||
**Symptômes** : Vous publiez des mises à jour de la documentation, mais les modifications n'apparaissent pas sur votre site.
|
||
|
||
**Cause** : Vous avez activé **Host at `/docs`** dans votre Dashboard, mais votre proxy inverse pointe vers `mintlify.app` au lieu de `mintlify.dev`.
|
||
|
||
**Solution** : Mettez à jour la configuration de votre proxy inverse pour qu'il pointe vers `<your-subdomain>.mintlify.dev` au lieu de `<your-subdomain>.mintlify.app`.
|
||
|
||
<div id="404-error">
|
||
### Erreur 404
|
||
</div>
|
||
|
||
**Symptômes** : La documentation se charge, mais certaines fonctionnalités ne fonctionnent pas. Les appels à l’API échouent.
|
||
|
||
**Cause** : Le proxy inverse transmet l’en-tête `Host` ou l’en-tête `Origin` est manquant.
|
||
|
||
**Solution** :
|
||
|
||
- Supprimer le transfert de l’en-tête `Host`
|
||
- Définir l’en-tête `Origin` sur votre sous-domaine Mintlify (`mintlify.dev` pour un sous-chemin `/docs` ou `mintlify.app` pour un autre sous-chemin)
|
||
|
||
<div id="performance-issues">
|
||
### Problèmes de performances
|
||
</div>
|
||
|
||
**Symptômes** : temps de chargement lents et décalages de mise en page.
|
||
|
||
**Cause** : configuration de la mise en cache incorrecte.
|
||
|
||
**Solution** : pour les configurations de sous-chemins personnalisées, activez la mise en cache uniquement pour les chemins `/mintlify-assets/_next/static/*`. La configuration du sous-chemin `/docs` gère automatiquement la mise en cache. |