Skip to content

Commit

Permalink
hopeless try
Browse files Browse the repository at this point in the history
  • Loading branch information
olduh29 committed May 3, 2024
1 parent 621db89 commit d776fb7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions dendrOnlineSPA/NoCors.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace dendrOnlineSPA;

public static class NoCors
{
public static WebApplication UseNoCors(this WebApplication app)
{
app.Use(async (context, next) =>
{
context.Response.Headers.Add("Access-Control-Allow-Methods", "*");
context.Response.Headers.Add("Access-Control-Allow-Headers", "*");
context.Response.Headers.Add("Access-Control-Allow-Origin", "*");
await next.Invoke();
});

return app;
}
}
2 changes: 2 additions & 0 deletions dendrOnlineSPA/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
options.ExcludePath = "/health";
});

app.UseNoCors();

if (app.Environment.IsDevelopment())
{
app.Run();
Expand Down

0 comments on commit d776fb7

Please sign in to comment.