I have some APIs created and they need to be called from known servers. How do I handle CORS in V9 - I couldn't find anything in the documentation (hopefully me just missing it somehow).
Thanks Simon. I had in fact seen that post in my Googling and forum search before posting here.
I think that this kind of thing should be more formally part of the V9 documentation. I'll have a check through, and may jump onto the Git repo with that as a suggestion / see if i can add to it.
public class ConfigureCorsOptions : IConfigureOptions<UmbracoPipelineOptions>
{
public void Configure(UmbracoPipelineOptions options)
{
options.AddFilter(new CorsPipelineFilter());
}
}
Umbraco V9 - CORS - How should it be handled
I have some APIs created and they need to be called from known servers. How do I handle CORS in V9 - I couldn't find anything in the documentation (hopefully me just missing it somehow).
Many thanks,
Dave
Take a look at this thread :)
Thanks Simon. I had in fact seen that post in my Googling and forum search before posting here.
I think that this kind of thing should be more formally part of the V9 documentation. I'll have a check through, and may jump onto the Git repo with that as a suggestion / see if i can add to it.
Thanks again.
Hi David
I have same requirement as you.
Did you manage to get this working? I haven't had any joy so far with implementing.
Jules
Thanks to Andy Butland and his blog article Customising the Umbraco Pipeline.
This is how to do it for Cors:
Create a PipelineFilter:
Add filter to Pipeline:
in Startup in ConfigureServices method:
Thanks Jules,
this made it clear! Btw. I have just tested it with Umbraco version 11.0.0
But actually this post (https://our.umbraco.com/forum/using-umbraco-and-getting-started/110188-cors-in-umbraco-10-how-to) is an even better solution, because it follows the standard way of doing it and requires less effort.
Dirk
is working on a reply...