December 2019
Intermediate to advanced
598 pages
12h 21m
English
In this section, we are going to change our CORS configuration to reference appsettings.json so that it's not hardcoded. We are then going to create separate appsettings.json files for staging and production as well for working locally in development. Let's open our backend project in Visual Studio and carry out the following steps:
services.AddCors(options => options.AddPolicy("CorsPolicy", builder => builder .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials() .WithOrigins(Configuration["Frontend"])));
We have simply changed the origin to reference a Frontend ...