Created
February 16, 2019 11:38
-
-
Save evan-boissonnot/640456d16324816c031a82d4a8f96f58 to your computer and use it in GitHub Desktop.
AddCors, AddPolicy, AllowSpecificOrigin asp.net core api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); | |
services.AddCors(options => | |
{ | |
options.AddPolicy("AllowSpecificOrigin", | |
builder => builder.WithOrigins("http://example.com")); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment