diff options
author | Rory& <root@rory.gay> | 2024-02-28 22:27:03 +0100 |
---|---|---|
committer | Rory& <root@rory.gay> | 2024-02-28 22:27:03 +0100 |
commit | 22e0884f74670b132bb47af7fce20bbcaec01808 (patch) | |
tree | 1ac0d64f51bdc30ffed14052855f4b06e10d3859 | |
parent | Alternate header handling for request headers (diff) | |
download | MatrixMediaGate-22e0884f74670b132bb47af7fce20bbcaec01808.tar.xz |
Alternate header handling for request headers
-rw-r--r-- | MatrixMediaGate/Program.cs | 7 |
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; |