Skip to content

Instantly share code, notes, and snippets.

@jagchat
Created October 19, 2023 00:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jagchat/468f10b1d2c5565a8197daa7276b0a67 to your computer and use it in GitHub Desktop.
Save jagchat/468f10b1d2c5565a8197daa7276b0a67 to your computer and use it in GitHub Desktop.
//https://ryansouthgate.com/asp-net-core-cors-wildcard-subdomains/
public virtual void ConfigureServices(IServiceCollection services)
{
//...other ASP.NET Setup
services.AddCors(options =>
{
options.AddDefaultPolicy(
builder => builder
.WithOrigins
(
"https://*.ryansouthgate.com"
)
// This method call is important!
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowAnyMethod()
.AllowAnyHeader());
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment