-
Hi, Not sure if there is a feature for this already, but I could not find it in ASP.NET Core 3.1. There are cloud hosting scenarios where the URL is dynamic, especially in frontend hosting providers like Heroku, Vercel or Netlify. The workflow process automatically provisions environments when opening a PR on GitHub. For example, in case of Heroku review apps , this would mean I would get a url on a predictable pattern, but with the subdomain changing: I expect it would be similar for Azure Static Web Apps, as well. Often we need to set CORS settings in APIs, to allow requests from these domains. Currently, I can only set a wildcard setting on the CORS policy: services.AddCors(options =>
{
options.AddDefaultPolicy(builder =>
{
builder.WithOrigins("https://*.domain").SetIsOriginAllowedToAllowWildcardSubdomains()
}
} , but of course, I don't want any app on Heroku to be allowed here. Just the ones with my It would be nice to get an extension point for validation, builder.WithOriginsValidator<MyCustomDynamicHerokuURLCORSValidator>() or if there was support for builder.WithOrigins("https://mypredictable-*.herokuapp.com").SetIsOriginAllowedToAllowDynamicSubdomains() Please let me know if there are available extension points to support dynamic environments like this already, I might have missed it. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Here's a similar extension in Spring Boot (Java): |
Beta Was this translation helpful? Give feedback.
-
Moved this to a feature request as in issue in #27435 |
Beta Was this translation helpful? Give feedback.
Moved this to a feature request as in issue in #27435