Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • David Walker 19 posts 90 karma points
    May 16, 2022 @ 13:01
    David Walker

    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,


  • Simon Justesen 68 posts 183 karma points
    May 17, 2022 @ 13:07
    Simon Justesen

    Take a look at this thread :)

  • David Walker 19 posts 90 karma points
    May 18, 2022 @ 12:49
    David Walker

    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.

  • Jules 243 posts 533 karma points
    May 19, 2022 @ 17:05

    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 243 posts 533 karma points
    May 20, 2022 @ 10:43

    Thanks to Andy Butland and his blog article Customising the Umbraco Pipeline.

    This is how to do it for Cors:

    Create a PipelineFilter:

    public CorsPipelineFilter() : base(nameof(CorsPipelineFilter))
        PostPipeline = app =>
            app.UseCors(policy => policy
            //Also works
            //app.UseCors(policy => policy.WithOrigins("http://localhost:36261"));

    Add filter to Pipeline:

    public class ConfigureCorsOptions : IConfigureOptions<UmbracoPipelineOptions>
        public void Configure(UmbracoPipelineOptions options)
            options.AddFilter(new CorsPipelineFilter());

    in Startup in ConfigureServices method:

  • Dirk Seefeld 126 posts 664 karma points
    Dec 13, 2022 @ 10:06
    Dirk Seefeld

    Thanks Jules,

    this made it clear! Btw. I have just tested it with Umbraco version 11.0.0

    But actually this post ( is an even better solution, because it follows the standard way of doing it and requires less effort.


Please Sign in or register to post replies

Write your reply to: