Update CORS to make it run on localhost
This commit is contained in:
parent
2732794750
commit
025983bd21
@ -16,6 +16,7 @@ To run in development mode, you will need:
|
||||
### Running locally
|
||||
To run in development mode, run:
|
||||
```sh
|
||||
cd YPS.Beer/
|
||||
dotnet run
|
||||
```
|
||||
|
||||
|
@ -29,7 +29,10 @@ builder.Services.AddAuthentication(IdentityConstants.ApplicationScheme)
|
||||
.AddApplicationCookie();
|
||||
builder.Services.AddAuthorizationBuilder();
|
||||
|
||||
builder.Services.AddCors();
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddDefaultPolicy(policy => policy.WithOrigins("http://localhost:3000").AllowAnyMethod().AllowAnyHeader().AllowCredentials());
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
@ -37,12 +40,16 @@ if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
|
||||
app.UseCors(cors => cors.AllowAnyHeader().AllowAnyMethod().SetIsOriginAllowed(_ => true).AllowCredentials());
|
||||
}
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseCors();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.MapIdentityApi<User>();
|
||||
|
Loading…
Reference in New Issue
Block a user