mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
[AC-1971] Add SwaggerUI to CORS policy (#3583)
* Allow SwaggerUI authorize requests if in development
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user