Skip to content

Commit

Permalink
allow any CORS header from the browser (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelsavara committed May 20, 2021
1 parent 31d6c34 commit 74d69c8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Microsoft.DotNet.XHarness.CLI/Commands/WebServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ internal static async Task<ServerURLs> Start(TestCommandArguments arguments, ILo
})
.ConfigureServices((ctx, services) =>
{
services.AddCors(o => o.AddPolicy("AnyCors", builder =>
{
builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader();
}));
services.AddRouting();
services.AddSingleton<ILogger>(logger);
services.Configure<TestWebServerOptions>(ctx.Configuration);
Expand Down Expand Up @@ -118,6 +124,7 @@ public void Configure(IApplicationBuilder app, IOptionsMonitor<TestWebServerOpti

var options = optionsAccessor.CurrentValue;

app.UseCors("AnyCors");
app.UseWebSockets();
if (options.OnConsoleConnected != null)
{
Expand Down

0 comments on commit 74d69c8

Please sign in to comment.