Skip to content

Commit 75c286f

Browse files
Add CORS support to Dev Proxy web API (#1496)
* Initial plan * Add CORS support to Dev Proxy web API Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
1 parent d15d221 commit 75c286f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

DevProxy/Extensions/IServiceCollectionExtensions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ public static IServiceCollection ConfigureDevProxyServices(
2121
DevProxyConfigOptions options)
2222
{
2323
_ = services.AddControllers();
24+
_ = services.AddCors(options =>
25+
{
26+
options.AddDefaultPolicy(builder =>
27+
{
28+
_ = builder
29+
.AllowAnyOrigin()
30+
.AllowAnyMethod()
31+
.AllowAnyHeader();
32+
});
33+
});
2434
_ = services
2535
.AddApplicationServices(configuration, options)
2636
.AddHostedService<ProxyEngine>()

DevProxy/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ static WebApplication BuildApplication(DevProxyConfigOptions options)
3232

3333
var app = builder.Build();
3434

35+
_ = app.UseCors();
3536
_ = app.UseSwagger();
3637
_ = app.UseSwaggerUI();
3738
_ = app.MapControllers();

0 commit comments

Comments
 (0)