Passer au contenu principal
Les configurations de proxy inverse ne sont prises en charge que pour les offres Custom.
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.

Configuration du routage

Redirigez ces chemins vers votre sous-domaine Mintlify avec les politiques de mise en cache indiquées :
CheminDestinationMise en cache
/.well-known/acme-challenge/*<your-subdomain>.mintlify.appPas de cache
/.well-known/vercel/*<your-subdomain>.mintlify.appPas de cache
/.well-known/skills/*<your-subdomain>.mintlify.appPas de cache
/skill.md<your-subdomain>.mintlify.appPas de cache
/mintlify-assets/_next/static/*<your-subdomain>.mintlify.appCache activé
/_mintlify/*<your-subdomain>.mintlify.appPas de cache
/*<your-subdomain>.mintlify.appPas de cache
/<your-subdomain>.mintlify.appPas de cache

Configuration d’en-têtes requise

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
Assurez-vous que l’en-tête Host n’est pas transmis

Exemple de configuration Nginx

server {
    listen 80;
    server_name <your-domain>.com;

    # Let's Encrypt verification paths
    location ~ ^/\.well-known/acme-challenge/ {
        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";
    }

    # 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";
    }

    # 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";
    }

    # 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";
    }
}

Résolution des problèmes

Erreur 404

Symptômes : La documentation se charge, mais certaines fonctionnalités ne fonctionnent pas. Les appels à l’API échouent. Cause : L’en-tête Host est transmis 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 <your-subdomain>.mintlify.app

Problèmes de performances

Symptômes : temps de chargement lents et décalages de mise en page. Cause : configuration de la mise en cache incorrecte. Solution : activez la mise en cache uniquement pour les chemins /mintlify-assets/_next/static/*.