about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-02-28 22:27:03 +0100
committerRory& <root@rory.gay>2024-02-28 22:27:03 +0100
commit22e0884f74670b132bb47af7fce20bbcaec01808 (patch)
tree1ac0d64f51bdc30ffed14052855f4b06e10d3859
parentAlternate header handling for request headers (diff)
downloadMatrixMediaGate-22e0884f74670b132bb47af7fce20bbcaec01808.tar.xz
Alternate header handling for request headers
-rw-r--r--MatrixMediaGate/Program.cs7
1 files changed, 6 insertions, 1 deletions
diff --git a/MatrixMediaGate/Program.cs b/MatrixMediaGate/Program.cs

index cef146f..9436230 100644 --- a/MatrixMediaGate/Program.cs +++ b/MatrixMediaGate/Program.cs
@@ -25,9 +25,14 @@ async Task Proxy(HttpClient hc, ProxyConfiguration cfg, HttpContext ctx, ILogger var method = new HttpMethod(ctx.Request.Method); using var req = new HttpRequestMessage(method, path); + hc.DefaultRequestHeaders.Clear(); + req.Headers.Clear(); foreach (var header in ctx.Request.Headers) { - if (header.Key != "Accept-Encoding" && header.Key != "Content-Type" && header.Key != "Content-Length") + if (header.Key != "Accept-Encoding" && header.Key != "Content-Type" && header.Key != "Content-Length") { + // req.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray()); + req.Headers.Remove(header.Key); req.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray()); + } } req.Headers.Host = cfg.Host;