[GH-ISSUE #4969] [Question]: hysteria2 does not read/cannot find the masquerade file #3487

Closed
opened 2026-10-31 20:32:47 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @warmpain9 on GitHub (Jun 5, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4969

What are you trying to do?

Greetings, i have a masq file for hysteria2 by dir: /var/www/html with masq file, hysteria2 works just fine but when it comes to a website i can't get on it, sends an error, as ALPn i used h3, website doesn't work even when both 443 tcp and 443 udp ports are free to use. Am i doing something wrong? Or do i need to install something like caddy or nginx to make this work?

(as for domain, i have my own, connected to cloudflare's NS)
(on a server where hysteria set up w/o panels webiste works perfecrly fine)

What have you already tried?

Moving file in another directory
Making file lighter (a few Kb)
reinstalling 3x-ui
switching versions

3x-ui version

3.2.8

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu 24.04

Screenshots or config snippets

No response

Before submitting

  • I read the Wiki and searched existing issues.
  • This is a usage question, not a bug report.
  • This question is written in English.
Originally created by @warmpain9 on GitHub (Jun 5, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4969 ### What are you trying to do? Greetings, i have a masq file for hysteria2 by dir: /var/www/html with masq file, hysteria2 works just fine but when it comes to a website i can't get on it, sends an error, as ALPn i used h3, website doesn't work even when both 443 tcp and 443 udp ports are free to use. Am i doing something wrong? Or do i need to install something like caddy or nginx to make this work? (as for domain, i have my own, connected to cloudflare's NS) (on a server where hysteria set up w/o panels webiste works perfecrly fine) ### What have you already tried? Moving file in another directory Making file lighter (a few Kb) reinstalling 3x-ui switching versions ### 3x-ui version 3.2.8 ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu 24.04 ### Screenshots or config snippets _No response_ ### Before submitting - [x] I read the [Wiki](https://github.com/MHSanaei/3x-ui/wiki) and searched [existing issues](../issues?q=is%3Aissue). - [x] This is a usage question, not a bug report. - [x] This question is written in English.
bsakaguchi 2026-10-31 20:32:47 +07:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@github-actions[bot] commented on GitHub (Jun 5, 2026):

Hi @warmpain9 — this is a fundamental architectural difference between standalone Hysteria2 and Xray-core's Hysteria2 implementation.

Why the masquerade website doesn't work in a browser

Xray-core's Hysteria2 transport only listens on UDP (QUIC). The masquerade feature in Xray serves HTTP/3 responses over that same UDP socket — it disguises the inbound at the QUIC/protocol level. It does not open a TCP 443 listener.

When a regular browser navigates to https://your-domain.com, it first tries a standard TCP/TLS connection. Since nothing is listening on TCP 443, the browser gets a connection error immediately and never attempts QUIC/UDP.

Why it works in standalone Hysteria2

Standalone Hysteria2 has a masquerade.listenHTTPS: :443 option that opens a separate TCP 443 listener alongside the UDP one, so regular browsers hit a real HTTPS server. Xray-core does not expose this option — the masquerade config keys 3x-ui sends (type, dir, url, etc.) are passed through as-is to Xray, but there is no listenHTTPS/forceHTTPS equivalent in the Xray Hysteria2 transport.

This was also observed in issue #4553.

How to fix it

You need a web server (nginx or Caddy) to handle TCP 443 traffic:

  1. nginx example — serves /var/www/html over HTTPS on TCP 443 and adds an Alt-Svc header so browsers know to upgrade to HTTP/3 on the next visit:

    server {
        listen 443 ssl;
        # listen [::]:443 ssl;
        server_name your-domain.com;
    
        ssl_certificate     /path/to/fullchain.pem;
        ssl_certificate_key /path/to/privkey.pem;
    
        root /var/www/html;
        index index.html;
    
        # Tell browsers: HTTP/3 (QUIC) is also available on port 443
        add_header Alt-Svc 'h3=":443"; ma=86400';
    
        location / {
            try_files $uri $uri/ =404;
        }
    }
    
  2. In 3x-ui, set your Hysteria2 inbound to listen on a different port (e.g., 8443) if you want nginx to own 443 TCP, or keep Hysteria2 on 443 UDP while nginx listens only on TCP 443 (they don't conflict since one is UDP and the other is TCP — Linux treats them as separate sockets).

  3. The masquerade setting inside 3x-ui (type: file, dir: /var/www/html) then only applies when an HTTP/3-capable client (or the censor's active prober using QUIC) connects — which is fine for censorship-evasion purposes. Regular browser visits go through nginx on TCP 443.

In short: yes, you need nginx or Caddy to make the website reachable from a browser. The 3x-ui masquerade config alone is not enough because Xray-core has no TCP listener for it.

<!-- gh-comment-id:4631930704 --> @github-actions[bot] commented on GitHub (Jun 5, 2026): Hi @warmpain9 — this is a fundamental architectural difference between standalone Hysteria2 and Xray-core's Hysteria2 implementation. **Why the masquerade website doesn't work in a browser** Xray-core's Hysteria2 transport only listens on **UDP** (QUIC). The masquerade feature in Xray serves HTTP/3 responses over that same UDP socket — it disguises the inbound at the QUIC/protocol level. It does **not** open a TCP 443 listener. When a regular browser navigates to `https://your-domain.com`, it first tries a standard **TCP/TLS** connection. Since nothing is listening on TCP 443, the browser gets a connection error immediately and never attempts QUIC/UDP. **Why it works in standalone Hysteria2** Standalone Hysteria2 has a `masquerade.listenHTTPS: :443` option that opens a *separate* TCP 443 listener alongside the UDP one, so regular browsers hit a real HTTPS server. Xray-core does not expose this option — the masquerade config keys 3x-ui sends (`type`, `dir`, `url`, etc.) are passed through as-is to Xray, but there is no `listenHTTPS`/`forceHTTPS` equivalent in the Xray Hysteria2 transport. This was also observed in issue #4553. **How to fix it** You need a web server (nginx or Caddy) to handle TCP 443 traffic: 1. **nginx example** — serves `/var/www/html` over HTTPS on TCP 443 and adds an `Alt-Svc` header so browsers know to upgrade to HTTP/3 on the next visit: ```nginx server { listen 443 ssl; # listen [::]:443 ssl; server_name your-domain.com; ssl_certificate /path/to/fullchain.pem; ssl_certificate_key /path/to/privkey.pem; root /var/www/html; index index.html; # Tell browsers: HTTP/3 (QUIC) is also available on port 443 add_header Alt-Svc 'h3=":443"; ma=86400'; location / { try_files $uri $uri/ =404; } } ``` 2. In 3x-ui, set your Hysteria2 inbound to listen on **a different port** (e.g., 8443) if you want nginx to own 443 TCP, **or** keep Hysteria2 on 443 UDP while nginx listens only on TCP 443 (they don't conflict since one is UDP and the other is TCP — Linux treats them as separate sockets). 3. The masquerade setting inside 3x-ui (`type: file`, `dir: /var/www/html`) then only applies when an HTTP/3-capable client (or the censor's active prober using QUIC) connects — which is fine for censorship-evasion purposes. Regular browser visits go through nginx on TCP 443. **In short:** yes, you need nginx or Caddy to make the website reachable from a browser. The 3x-ui masquerade config alone is not enough because Xray-core has no TCP listener for it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3487
No description provided.