Skip HeadersOverrideMiddleware if on onion

This commit is contained in:
nicolas.dorier 2019-10-10 14:10:01 +09:00
parent ca17efbc29
commit 40b191ef49
No known key found for this signature in database
GPG key ID: 6618763EF09186FE

View file

@ -22,9 +22,12 @@ namespace BTCPayServer.Hosting
public async Task Invoke(HttpContext httpContext) public async Task Invoke(HttpContext httpContext)
{ {
if (!string.IsNullOrEmpty(overrideXForwardedProto)) if (!string.IsNullOrEmpty(overrideXForwardedProto))
{
if (!httpContext.Request.Host.Host.EndsWith(".onion", StringComparison.OrdinalIgnoreCase))
{ {
httpContext.Request.Headers["X-Forwarded-Proto"] = overrideXForwardedProto; httpContext.Request.Headers["X-Forwarded-Proto"] = overrideXForwardedProto;
} }
}
await _Next(httpContext); await _Next(httpContext);
} }
} }