mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-10-27 00:04:59 +03:00
fix(panel): default TLS ALPN to http/1.1 for WebSocket transport (#6787)
* fix(panel): default TLS ALPN to http/1.1 for WebSocket transport WebSocket bootstraps over HTTP/1.1: leaving ALPN at the schema default ['h2','http/1.1'] makes the server negotiate h2 and the WS handshake fails. See issue #6782. * style(frontend): keep comments within the two-line limit * style(frontend): keep comments within the two-line limit
This commit is contained in:
@@ -14,7 +14,7 @@ function defaultCertificate(): Record<string, unknown> {
|
||||
};
|
||||
}
|
||||
|
||||
export function createTlsSettingsWithDefaultCert(): Record<string, unknown> {
|
||||
export function createTlsSettingsWithDefaultCert(network?: string): Record<string, unknown> {
|
||||
const tls = TlsStreamSettingsSchema.parse({}) as Record<string, unknown>;
|
||||
tls.certificates = [defaultCertificate()];
|
||||
const settings =
|
||||
@@ -23,6 +23,11 @@ export function createTlsSettingsWithDefaultCert(): Record<string, unknown> {
|
||||
: {};
|
||||
settings.fingerprint = 'chrome';
|
||||
tls.settings = settings;
|
||||
/* WebSocket bootstraps over HTTP/1.1: the schema default ALPN
|
||||
* ['h2','http/1.1'] makes the server negotiate h2 (see issue #6782). */
|
||||
if (network === 'ws') {
|
||||
tls.alpn = ['http/1.1'];
|
||||
}
|
||||
return tls;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user