Skip to content

Commit

Permalink
🐛 Fix 421 Misdirected Request
Browse files Browse the repository at this point in the history
  • Loading branch information
rmbadmin committed Oct 6, 2023
1 parent ce6fd9a commit 0ed0416
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
var tlsSniValue = domainConfig.GetTlsSniPattern().WithDomain(uri.Host).WithRandom();
request.SetRequestContext(new RequestContext(isHttps, tlsSniValue));

//// 设置请求头 host,修改协议为 http
//request.Headers.Host = uri.Host;
//request.RequestUri = new UriBuilder(uri) { Scheme = Uri.UriSchemeHttp }.Uri;
// 设置请求头 host,修改协议为 http
request.Headers.Host = uri.Host;
request.RequestUri = new UriBuilder(uri) { Scheme = Uri.UriSchemeHttp }.Uri;

if (domainConfig.Timeout != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public async Task InvokeAsync(HttpContext context, RequestDelegate next)

var forwarderRequestConfig = new ForwarderRequestConfig()
{
Version = context.Request.Protocol.StartsWith("HTTP/2.0") ? System.Net.HttpVersion.Version20 : System.Net.HttpVersion.Version11,
Version = context.Request.Protocol.StartsWith("HTTP/2") ? System.Net.HttpVersion.Version20 : System.Net.HttpVersion.Version11,
};

var error = await httpForwarder.SendAsync(context, destinationPrefix, httpClient, forwarderRequestConfig, HttpTransformer.Empty);
Expand Down

0 comments on commit 0ed0416

Please sign in to comment.