Transport XHTTP pour Xray : guide complet de configuration et différences avec HTTP

En bref

Analyse approfondie du transport XHTTP dans Xray : fonctionnement, différences avec HTTP/WS/gRPC, cas d'utilisation, configuration optimale sur serveur et client, amélioration de la résistance au DPI et réduction des latences. Instructions pas à pas, check-lists, cas pratiques et FAQ pour les utilisateurs avancés.

Transport XHTTP pour Xray : guide complet de configuration et différences avec HTTP

Introduction

Le transport XHTTP pour Xray est devenu, entre 2024 et 2026, l’une des méthodes les plus efficaces pour camoufler le trafic sous un HTTP classique et ainsi passer sans encombre les DPI modernes. La raison est simple : de nombreux réseaux continuent d’autoriser le HTTP(S) traditionnel pour le trafic légal, et XHTTP reproduit ces échanges sans utiliser le framing lourd d’HTTP/2 ou WebSocket. Dans ce guide, nous expliquerons ce qu’est XHTTP dans le contexte de Xray, son fonctionnement interne, ses différences avec le transport HTTP standard, nous proposerons des schémas résistants aux DPI, des check-lists, des conseils sur la performance et la surveillance, ainsi que les erreurs typiques qui brisent la connexion en conditions réelles. Au final, vous disposerez d’une méthodologie complète pour concevoir, déployer et maintenir XHTTP selon vos scénarios, du simple accès domestique aux réseaux d’entreprise ou mobiles.

Les bases

Qu’est-ce que Xray et un transport

Xray-core est un moteur proxy performant offrant un modèle flexible combinant protocole + transport + chiffrement. Les protocoles applicatifs (VLESS, VMess, Trojan, etc.) gèrent l’authentification et le multiplexage des sessions, tandis que le transport (TCP, WebSocket, HTTP/2, gRPC, QUIC, XHTTP) détermine comment les octets circulent sur le réseau et quels signes sont visibles par les DPI ou intermédiaires. Le chiffrement (TLS/XTLS/REALITY) et l’émulation client (uTLS, empreintes JA3) protègent le contenu et masquent le profil TLS pour ressembler à un vrai navigateur.

Où se place XHTTP dans cette matrice

XHTTP est un mode de transport qui mime le dialogue classique HTTP/1.1 avec la possibilité d’utiliser TLS ou TCP brut (les équivalents h2c ne sont pas nécessaires). Son but est de fournir un profil aussi « normal » que possible face aux DPI : en-têtes, méthodes, chemins, keep-alive, encodage chunked, schémas d’Upgrade — puis après cet échange légitime, il bascule le flux en canal binaire bidirectionnel pour le trafic proxy réel. Vu de l’extérieur, c’est une requête/réponse HTTP prolongée avec une connexion vivante, et de l’intérieur, un pipeline pour votre VLESS/VMess.

Pourquoi ça résiste au DPI

  • Sémantique HTTP/1.1. La plupart des DPI « comprennent » et laissent passer les en-têtes HTTP typiques, méthodes (GET/POST/OPTIONS), encodages (chunked), connexions keep-alive.
  • Framing minimal. Contrairement à HTTP/2 ou WebSocket, XHTTP n’introduit pas de trames/opcodes explicites, il maintient le flux comme s’il s’agissait du corps d’un POST ou d’une mise à niveau. Pour nombre d’inspecteurs, c’est un comportement « normal ».
  • Imitation flexible. Les en-têtes (User-Agent, Accept, Referer), chemins, hôtes, codes de réponse et même les intervalles de transmission peuvent être reproduits fidèlement pour correspondre à des backends réels.

Comparaison avec le transport HTTP classique dans Xray

Xray intègre un transport HTTP (souvent HTTP/2 ou mode h2c) conçu autour du framing et multiplexage des flux au sein d’HTTP/2. C’est pratique, mais cela laisse des empreintes visibles (ALPN h2, profils HPACK et préambules particuliers) et demande une négociation plus complexe. XHTTP évite ces signaux évidents d’HTTP/2, il est souvent préférable dans les réseaux restreints acceptant seulement du HTTP/1.1 simple sur TLS 1.3, là où les segments HTTP/2/H3 sont suspectés ou bloqués.

Immersion profonde

Architecture du flux XHTTP

  1. Établissement TCP/TLS. Le client ouvre une connexion TCP (ou TLS). En TLS, uTLS se lance pour imiter un navigateur réel (JA3, SNI, ALPN — habituellement http/1.1, parfois h2 pour plus de réalisme).
  2. Requête HTTP. Le client envoie une requête HTTP/1.1 crédible : méthode (souvent POST ou GET), chemin (ex. /api, /health, /v1/upload), en-têtes (Host, User-Agent, Accept, Accept-Language, Content-Type, Connection: keep-alive, TE: trailers, Cache-Control, X-Requested-With, etc.). Deux motifs possibles : « corps POST long » ou « échange type Upgrade ».
  3. Réponse serveur. Le serveur renvoie 200/204/101 selon le motif, des en-têtes serveur corrects (Server: nginx, Date, Content-Type, Transfer-Encoding: chunked, Connection: keep-alive), puis garde la connexion ouverte.
  4. Tunnel. Ensuite, les deux côtés échangent les octets utiles du protocole Xray, cachés dans le corps et segments chunked. Pour le DPI, c’est une connexion HTTP vivante avec un corps ou des chunks persistants.

Différences clés entre XHTTP vs HTTP/2 et WebSocket

  • Pas de framing explicite au niveau navigateur. H2/H3 sont repérables : ALPN h2/h3, priorités, HPACK/QPACK. WS montre des en-têtes Upgrade: websocket, Sec-WebSocket-Key/Accept. XHTTP utilise des en-têtes « classiques ».
  • Moins de signatures. Les DPI sont souvent entraînés à détecter WebSocket et profils HPACK atypiques. XHTTP s’insère dans la pile HTTP/1.1 ancienne et connue.
  • Leurre flexible. Il peut faire croire à un téléchargeur, un téléverseur, un SSE long ou un endpoint API à réponse lente.
  • Robustesse dans les réseaux bruités. Le traitement simple de HTTP/1.1 et chunked fonctionne souvent bien derrière des proxies d’entreprise et NAT.

Performance et overhead

  • Surcharge des en-têtes : faible mais prévisible. Sur de longues sessions, l’impact est minime.
  • RTT : un RTT additionnel pour la requête/réponse HTTP en plus du TLS, réduit grâce au keep-alive et données anticipées si supportées.
  • Débit : comparable à TCP+TLS « nu » ; le goulet d’étranglement est souvent la proxy/balance ou la mise en tampon.

Compatibilité et ALPN

En pratique, ALPN « http/1.1 » offre le profil le plus neutre. Si le réseau préfère h2, on peut ajouter « h2 » à la liste, mais il faut une réponse serveur adaptée, sinon la négociation échouera. Pour plus de crédibilité, activez l’émulation uTLS des versions récentes de Chrome/Firefox.

Partie pratique 1 : schéma minimal VLESS+XHTTP sur TLS

Objectif

Déployer Xray avec le protocole VLESS et transport XHTTP sur le port 443/tcp avec un certificat valide. À l’extérieur, un site classique sur le même domaine ou un placeholder statique ; le trafic proxy transite via un chemin XHTTP.

Étapes

  1. Domaine et DNS. Configurez les records A/AAAA vers votre VPS. Vérifiez que votre IP n’est pas dans des listes noires évidentes.
  2. Certificat. Installez certbot ou Caddy pour TLS automatique. Limitez les ALPN inutiles si h2 n’est pas utilisé.
  3. Xray. Mettez à jour à la version 2026. Assurez-vous que la build supporte le transport XHTTP.
  4. Configuration serveur. Créez un inbound VLESS avec streamSettings: network: xhttp, security: tls. Définissez des en-têtes et chemin crédibles.
  5. Configuration client. Utilisez aussi network: xhttp, serverName et chemin/hôte identiques au serveur. Activez uTLS.
  6. Firewall. Ouvrez 443/tcp, bloquez les ports superflus. Activez les optimisations conntrack.
  7. Vérification. Testez avec curl -v https://votre_domaine/chemin — vous devez obtenir un 200/204 honnête. Puis testez la connexion client Xray et analysez les logs.

Exemple de paramètres (version abrégée)

Serveur : protocol: vless; clients: UUID; decryption: none; streamSettings: network: xhttp; security: tls; tlsSettings: serverName: votre_domaine; alpn: ["http/1.1"]; xhttpSettings: host: ["votre_domaine"], path: "/api", method: "POST", headers: {"User-Agent": ["Mozilla/5.0"], "Accept": ["* .related-articles { padding-top: 1rem; } .related-title { font-size: 1.75rem; font-weight: 700; color: var(--gray-900); margin-bottom: 1.5rem; padding-bottom: 0.75rem; border-bottom: 2px solid rgba(59,130,246,0.1); } .related-card { display: flex; flex-direction: column; gap: 0.5rem; height: 100%; background: white; border: 2px solid #e5e7eb; border-radius: 1rem; padding: 1.25rem 1.5rem; text-decoration: none; transition: all 0.3s cubic-bezier(0.4,0,0.2,1); box-shadow: 0 2px 8px rgba(0,0,0,0.04); } .related-card:hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(59,130,246,0.15); border-color: var(--primary); } .related-card-title { font-size: 1.0625rem; font-weight: 600; color: var(--gray-900); line-height: 1.4; } .related-card-meta { font-size: 0.8125rem; color: #6b7280; display: flex; align-items: center; gap: 0.375rem; } .article-tldr { position: relative; margin: 0 0 2rem; padding: 1.25rem 1.5rem 1.25rem 1.75rem; background: linear-gradient(135deg, rgba(59,130,246,0.06), rgba(139,92,246,0.05)); border-start: 4px solid var(--primary); border-radius: 0.75rem; } .article-tldr-label { display: inline-block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--primary); margin-bottom: 0.4rem; } .article-tldr p { margin: 0; font-size: 1.0625rem; line-height: 1.6; color: #374151; font-weight: 500; } [data-bs-theme="dark"] .article-tldr { background: linear-gradient(135deg, rgba(59,130,246,0.10), rgba(139,92,246,0.10)); } [data-bs-theme="dark"] .article-tldr p { color: #e5e7eb; } [data-bs-theme="dark"] .article-tldr-label { color: #60a5fa; } .author-bio-extended { margin: 2rem 0; } .author-bio-card { background: linear-gradient(135deg, rgba(59,130,246,0.03), rgba(139,92,246,0.03)); border: 1px solid rgba(59,130,246,0.15); border-radius: 1.5rem; padding: 2rem; box-shadow: 0 4px 12px rgba(0,0,0,0.04); transition: all 0.3s; } .author-bio-card:hover { box-shadow: 0 8px 24px rgba(59,130,246,0.12); transform: translateY(-2px); } .author-bio-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 2px solid rgba(59,130,246,0.15); } .author-bio-icon { width: 48px; height: 48px; background: linear-gradient(135deg, var(--primary), var(--accent)); border-radius: 12px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(59,130,246,0.3); } .author-bio-icon i { color: white; font-size: 1.25rem; } .author-bio-title { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); margin: 0; } .author-bio-content { display: grid; grid-template-columns: 150px 1fr; gap: 2rem; align-items: start; } .author-photo-wrapper { position: relative; width: 150px; height: 150px; } .author-photo { width: 100%; height: 100%; object-fit: cover; border-radius: 1rem; border: 3px solid white; box-shadow: 0 8px 20px rgba(0,0,0,0.1); } .author-photo-badge { position: absolute; bottom: -8px; right: -8px; width: 36px; height: 36px; background: linear-gradient(135deg, var(--success), #059669); border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 3px solid white; } .author-photo-badge i { color: white; font-size: 0.75rem; } .author-main-info { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid rgba(0,0,0,0.08); } .author-name { font-size: 1.25rem; font-weight: 700; color: var(--gray-900); margin: 0 0 0.25rem; } .author-job { font-size: 0.9rem; color: var(--primary); margin: 0; font-weight: 500; } .author-info-list { display: flex; flex-direction: column; gap: 1rem; } .author-info-item { display: flex; gap: 1rem; align-items: flex-start; } .info-icon { width: 36px; height: 36px; min-width: 36px; background: rgba(59,130,246,0.08); border-radius: 8px; display: flex; align-items: center; justify-content: center; } .info-icon i { color: var(--primary); font-size: 0.875rem; } .info-content { font-size: 0.9rem; line-height: 1.5; } .info-content strong { display: block; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; color: #6b7280; margin-bottom: 0.25rem; } .expertise-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.25rem; } .expertise-tag { padding: 0.25rem 0.75rem; background: rgba(59,130,246,0.08); color: var(--primary); border-radius: 1rem; font-size: 0.8rem; font-weight: 500; border: 1px solid rgba(59,130,246,0.15); } .achievements-list { margin: 0.25rem 0 0; padding-left: 1.25rem; } .achievements-list li { font-size: 0.9rem; margin-bottom: 0.25rem; } .author-bio-text { margin-top: 1rem; padding: 1rem; background: rgba(0,0,0,0.02); border-radius: 0.75rem; border-start: 3px solid var(--primary); } .author-bio-text p { margin: 0; font-size: 0.9rem; line-height: 1.6; color: #4b5563; } @media (max-width: 991px) { .article-content-card { padding: 2rem; } .article-title { font-size: 2rem !important; } .articleBody { font-size: 1rem; } .articleBody h2 { font-size: 1.75rem; } .articleBody h3 { font-size: 1.375rem; } } @media (max-width: 768px) { .article-content-card { padding: 1.5rem; border-radius: 1rem; } .article-title { font-size: 1.75rem !important; } .article-nav-title { font-size: 1rem; } .author-bio-content { grid-template-columns: 1fr; } .author-photo-wrapper { width: 100px; height: 100px; margin: 0 auto; } .info-icon { align-self: flex-start; } } [data-bs-theme="dark"] .article-search { background: #1f2937; border-color: rgba(255,255,255,0.1); color: #f9fafb; } [data-bs-theme="dark"] .article-search::placeholder { color: #9ca3af; } [data-bs-theme="dark"] .article-search:focus { border-color: var(--primary) !important; background: #1f2937; } [data-bs-theme="dark"] .article-content-card { background: #1f2937; border: 1px solid rgba(255,255,255,0.06); } [data-bs-theme="dark"] .article-title { color: #f9fafb !important; } [data-bs-theme="dark"] .article-meta { color: #9ca3af !important; } [data-bs-theme="dark"] .articleBody { color: #d1d5db; } [data-bs-theme="dark"] .articleBody h2, [data-bs-theme="dark"] .articleBody h3, [data-bs-theme="dark"] .articleBody h4 { color: #f9fafb; } [data-bs-theme="dark"] .articleBody a { color: #60a5fa; border-bottom-color: rgba(96,165,250,0.3); } [data-bs-theme="dark"] .articleBody a:hover { color: #93c5fd; border-bottom-color: #60a5fa; } [data-bs-theme="dark"] .articleBody blockquote { background: linear-gradient(135deg, rgba(59,130,246,0.1), rgba(139,92,246,0.1)); color: #d1d5db; } [data-bs-theme="dark"] .articleBody code { background: rgba(255,255,255,0.05); color: #f472b6; } [data-bs-theme="dark"] .articleBody pre { background: #111827; } [data-bs-theme="dark"] .article-nav-link { background: #1f2937; border-color: rgba(255,255,255,0.1); } [data-bs-theme="dark"] .article-nav-link:hover { border-color: rgba(59,130,246,0.5); } [data-bs-theme="dark"] .article-nav-direction { color: #60a5fa; } [data-bs-theme="dark"] .article-nav-title { color: #f9fafb; } [data-bs-theme="dark"] .author-bio-card { background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(139,92,246,0.08)); border-color: rgba(59,130,246,0.25); } [data-bs-theme="dark"] .author-bio-title, [data-bs-theme="dark"] .author-name { color: #f9fafb; } [data-bs-theme="dark"] .author-job { color: #60a5fa; } [data-bs-theme="dark"] .author-photo { border-color: #1f2937; } [data-bs-theme="dark"] .author-photo-badge { border-color: #1f2937; } [data-bs-theme="dark"] .author-main-info { border-bottom-color: rgba(255,255,255,0.1); } [data-bs-theme="dark"] .info-icon { background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.15)); } [data-bs-theme="dark"] .info-content { color: #d1d5db; } [data-bs-theme="dark"] .info-content strong { color: #f9fafb; } [data-bs-theme="dark"] .expertise-tag { background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.15)); color: #60a5fa; border-color: rgba(59,130,246,0.3); } [data-bs-theme="dark"] .author-bio-text { background: rgba(255,255,255,0.03); border-start-color: #60a5fa; } [data-bs-theme="dark"] .author-bio-text p { color: #d1d5db; } [data-bs-theme="dark"] .article-share-section h4 { color: #f9fafb; } [data-bs-theme="dark"] .related-title { color: #f9fafb; border-bottom-color: rgba(96,165,250,0.2); } [data-bs-theme="dark"] .related-card { background: #1f2937; border-color: rgba(255,255,255,0.1); } [data-bs-theme="dark"] .related-card:hover { border-color: rgba(59,130,246,0.5); } [data-bs-theme="dark"] .related-card-title { color: #f9fafb; } [data-bs-theme="dark"] .related-card-meta { color: #9ca3af; } body { background: #0A0E14 !important; } .breadcrumb { background: transparent !important; } .breadcrumb-item a { color: #8a94a6; } .breadcrumb-item.active { color: #6B7689 !important; } .breadcrumb-item + .breadcrumb-item::before { color: #4a5260 !important; } .article-content-card { background: transparent !important; border: 0 !important; box-shadow: none !important; } .article-title { color: #F5F6F7 !important; } .article-meta { color: #8a94a6 !important; } .article-meta i { color: #19E3B1 !important; } .article-search { background: #11161F !important; border: 1px solid rgba(245,246,247,.12) !important; color: #F5F6F7 !important; } .article-search::placeholder { color: #6B7689 !important; } .articleBody { color: #C5CAD3 !important; } .articleBody h2, .articleBody h3, .articleBody h4 { color: #F5F6F7 !important; } .articleBody h2 { border-bottom-color: rgba(245,246,247,.10) !important; } .articleBody a { color: #19E3B1 !important; border-bottom-color: rgba(25,227,177,.35) !important; } .articleBody a:hover { color: #3BEBC0 !important; border-bottom-color: #3BEBC0 !important; } .articleBody ul li::marker { color: #19E3B1 !important; } .articleBody blockquote { background: rgba(25,227,177,.05) !important; border-start-color: #19E3B1 !important; color: #aeb6c2 !important; } .articleBody code { background: rgba(25,227,177,.12) !important; color: #3BEBC0 !important; } .articleBody pre { background: #11161F !important; border: 1px solid rgba(245,246,247,.08) !important; color: #c2c9d4 !important; } .articleBody pre code { color: #c2c9d4 !important; } .articleBody img { box-shadow: 0 10px 34px rgba(0,0,0,.5) !important; } .article-tldr { background: rgba(25,227,177,.07) !important; border: 1px solid rgba(25,227,177,.22) !important; border-start: 3px solid #19E3B1 !important; } .article-tldr-label { color: #19E3B1 !important; } .article-tldr p { color: #c2c9d4 !important; } .article-share-section h4 { color: #F5F6F7 !important; } .article-nav-link, .related-card { background: #1A2230 !important; border: 1px solid rgba(245,246,247,.08) !important; box-shadow: none !important; } .article-nav-link:hover, .related-card:hover { border-color: rgba(25,227,177,.35) !important; box-shadow: 0 16px 40px -16px rgba(0,0,0,.6) !important; } .article-nav-direction { color: #19E3B1 !important; } .article-nav-title, .related-card-title, .related-title { color: #F5F6F7 !important; } .related-title { border-bottom-color: rgba(245,246,247,.10) !important; } .related-card-meta { color: #6B7689 !important; } .related-card-meta i { color: #19E3B1 !important; } .author-bio-card { background: #11161F !important; border-color: rgba(245,246,247,.08) !important; } .author-bio-header { border-bottom-color: rgba(245,246,247,.10) !important; } .author-bio-title, .author-name { color: #F5F6F7 !important; } .author-job { color: #19E3B1 !important; } .author-bio-icon { background: #19E3B1 !important; } .author-bio-icon i { color: #0A0E14 !important; } .author-main-info { border-bottom-color: rgba(245,246,247,.08) !important; } .author-photo { border-color: #1A2230 !important; } .info-icon { background: rgba(25,227,177,.12) !important; } .info-icon i { color: #19E3B1 !important; } .info-content { color: #c2c9d4 !important; } .info-content strong { color: #8a94a6 !important; } .expertise-tag { background: rgba(25,227,177,.10) !important; color: #19E3B1 !important; border-color: rgba(25,227,177,.22) !important; } .author-bio-text { background: rgba(255,255,255,.03) !important; border-start-color: #19E3B1 !important; } .author-bio-text p, .achievements-list li, .author-bio-content { color: #aeb6c2 !important; }