diff --git a/.gitignore b/.gitignore index 5a1150c..07e7156 100644 --- a/.gitignore +++ b/.gitignore @@ -30,4 +30,5 @@ build/ # MSTest test Results [Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* \ No newline at end of file +[Bb]uild[Ll]og.* +/src/Core/Properties/launchSettings.json diff --git a/src/Core/Extensions/Ws.cs b/src/Core/Extensions/Ws.cs index 7d05481..fdeea2a 100644 --- a/src/Core/Extensions/Ws.cs +++ b/src/Core/Extensions/Ws.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Linq; +using System.Net; using System.Net.WebSockets; using System.Text; using System.Threading; @@ -39,7 +40,13 @@ internal static async Task ExecuteWsProxyOperationAsync(this HttpContext context foreach (var headerEntry in context.Request.Headers) { if (!Helpers.WebSocketNotForwardedHeaders.Contains(headerEntry.Key, StringComparer.OrdinalIgnoreCase)) - socketToEndpoint.Options.SetRequestHeader(headerEntry.Key, headerEntry.Value); + { + if (!WebHeaderCollection.IsRestricted(headerEntry.Key)) + { + socketToEndpoint.Options.SetRequestHeader(headerEntry.Key, headerEntry.Value); + } + } + } if(options?.BeforeConnect != null)