This commit is contained in:
2025-05-29 14:06:47 +00:00
parent af13d3af10
commit e6b3ae395c
9 changed files with 246 additions and 196 deletions

View File

@ -320,6 +320,12 @@ export class RouteConnectionHandler {
const localPort = record.localPort;
const remoteIP = record.remoteIP;
// Check if this is an HTTP proxy port
const isHttpProxyPort = this.settings.useHttpProxy?.includes(localPort);
// For HTTP proxy ports without TLS, skip domain check since domain info comes from HTTP headers
const skipDomainCheck = isHttpProxyPort && !record.isTLS;
// Find matching route
const routeMatch = this.routeManager.findMatchingRoute({
port: localPort,
@ -327,6 +333,7 @@ export class RouteConnectionHandler {
clientIp: remoteIP,
path: undefined, // We don't have path info at this point
tlsVersion: undefined, // We don't extract TLS version yet
skipDomainCheck: skipDomainCheck,
});
if (!routeMatch) {

View File

@ -331,8 +331,9 @@ export class RouteManager extends plugins.EventEmitter {
clientIp: string;
path?: string;
tlsVersion?: string;
skipDomainCheck?: boolean;
}): IRouteMatchResult | null {
const { port, domain, clientIp, path, tlsVersion } = options;
const { port, domain, clientIp, path, tlsVersion, skipDomainCheck } = options;
// Get all routes for this port
const routesForPort = this.getRoutesForPort(port);
@ -341,7 +342,7 @@ export class RouteManager extends plugins.EventEmitter {
for (const route of routesForPort) {
// Check domain match
// If the route has domain restrictions and we have a domain to check
if (route.match.domains) {
if (route.match.domains && !skipDomainCheck) {
// If no domain was provided (non-TLS or no SNI), this route doesn't match
if (!domain) {
continue;
@ -352,6 +353,7 @@ export class RouteManager extends plugins.EventEmitter {
}
}
// If route has no domain restrictions, it matches all domains
// If skipDomainCheck is true, we skip domain validation for HTTP connections
// Check path match if specified in both route and request
if (path && route.match.path) {