You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm building a SaaS solution that uses Azure Functions to host the APIs via HttpTriggers.
For the most part this has worked well, however it seems not possible to support wildcard domains in the Azure portal (see Azure/azure-functions-host#3948), and very annoying to programmatically add them in via the resource manager APIs, so I decided to try the middleware APIs to reuse some of the CORS code from a typical aspnet core project.
In a typical aspnet core project I can then app.UseCors("myorigins") later in the bootstrap code - because I couldn't work out how to do this in the function, I've instead created middleware that reuses the CorsService and incorporates the workarounds to access the HttpRequestData/HttpResponseData.
I'm building a SaaS solution that uses Azure Functions to host the APIs via HttpTriggers.
For the most part this has worked well, however it seems not possible to support wildcard domains in the Azure portal (see Azure/azure-functions-host#3948), and very annoying to programmatically add them in via the resource manager APIs, so I decided to try the middleware APIs to reuse some of the CORS code from a typical aspnet core project.
I have this in my Program.cs:
In a typical aspnet core project I can then
app.UseCors("myorigins")
later in the bootstrap code - because I couldn't work out how to do this in the function, I've instead created middleware that reuses the CorsService and incorporates the workarounds to access the HttpRequestData/HttpResponseData.You can see the gist over here: https://gist.github.com/craigomatic/32c24e06262da0d332294075c053298a
Is there a better way to do this?
Ideally, I'd like to reuse the same code pattern as a typical aspnet core app.
The text was updated successfully, but these errors were encountered: