diff --git a/FastGithub.HttpServer/HttpProxyMiddleware.cs b/FastGithub.HttpServer/HttpProxyMiddleware.cs index d7ea09b..1cfd231 100644 --- a/FastGithub.HttpServer/HttpProxyMiddleware.cs +++ b/FastGithub.HttpServer/HttpProxyMiddleware.cs @@ -1,4 +1,6 @@ -using Microsoft.AspNetCore.Connections.Features; +using FastGithub.Configuration; +using FastGithub.DomainResolve; +using Microsoft.AspNetCore.Connections.Features; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.Options; @@ -97,7 +99,7 @@ namespace FastGithub.HttpServer { if (host.Host == LOOPBACK || host.Host == LOCALHOST) { - return host.Port == this.options.Value.HttpProxyPort; + return host.Port == null || host.Port == this.options.Value.HttpProxyPort; } return false; } diff --git a/FastGithub.HttpServer/HttpReverseProxyMiddleware.cs b/FastGithub.HttpServer/HttpReverseProxyMiddleware.cs index 45c2a06..20c7048 100644 --- a/FastGithub.HttpServer/HttpReverseProxyMiddleware.cs +++ b/FastGithub.HttpServer/HttpReverseProxyMiddleware.cs @@ -38,8 +38,8 @@ namespace FastGithub.HttpServer /// public async Task InvokeAsync(HttpContext context, RequestDelegate next) { - var host = context.Request.Host.Host; - if (this.fastGithubConfig.TryGetDomainConfig(host, out var domainConfig) == false) + var host = context.Request.Host; + if (this.fastGithubConfig.TryGetDomainConfig(host.Host, out var domainConfig) == false) { await next(context); } @@ -69,7 +69,7 @@ namespace FastGithub.HttpServer /// /// /// - private string GetDestinationPrefix(string scheme, string host, Uri? destination) + private string GetDestinationPrefix(string scheme, HostString host, Uri? destination) { var defaultValue = $"{scheme}://{host}/"; if (destination == null)