Fix onion location not always working (#1947)

closes #1881
This commit is contained in:
Andrew Camilleri 2020-10-07 10:21:18 +02:00 committed by GitHub
parent cfa568a230
commit 5131d8d328
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ using BTCPayServer.Logging;
using BTCPayServer.Models;
using BTCPayServer.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
@ -59,7 +60,7 @@ namespace BTCPayServer.Hosting
if (!httpContext.Request.IsOnion() && (httpContext.Request.Headers["Accept"].ToString().StartsWith("text/html", StringComparison.InvariantCulture)))
{
var onionLocation = _Env.OnionUrl + httpContext.Request.Path;
var onionLocation = _Env.OnionUrl + httpContext.Request.GetEncodedPathAndQuery();
httpContext.Response.SetHeader("Onion-Location", onionLocation);
}
}