mirror of
https://github.com/bitwarden/server.git
synced 2025-02-05 00:01:30 +01:00
[AC-1971] Add SwaggerUI to CORS policy (#3583)
* Allow SwaggerUI authorize requests if in development
This commit is contained in:
parent
c2d36cb28b
commit
af7811ba9a
@ -213,7 +213,11 @@ public class Startup
|
||||
app.UseRouting();
|
||||
|
||||
// Add Cors
|
||||
app.UseCors(policy => policy.SetIsOriginAllowed(o => CoreHelpers.IsCorsOriginAllowed(o, globalSettings))
|
||||
app.UseCors(policy => policy.SetIsOriginAllowed(o =>
|
||||
CoreHelpers.IsCorsOriginAllowed(o, globalSettings) ||
|
||||
|
||||
// If development - allow requests from the Swagger UI so it can authorize
|
||||
(Environment.IsDevelopment() && o == globalSettings.BaseServiceUri.Api))
|
||||
.AllowAnyMethod().AllowAnyHeader().AllowCredentials());
|
||||
|
||||
// Add current context
|
||||
|
Loading…
Reference in New Issue
Block a user