Smart search CORS settings

profound Team asked on January 25, 2019 14:41

When our smart search indexes rebuild on Azure, the CORS options are defaulting to blank, and we're manually having to add '*'. Is there any way to specify default CORS options in Smart search on Kentico 11?

Recent Answers

Jon Lord answered on February 22, 2019 17:26

I've not tried doing *, however the following code permits you to specify which websites to add your Azure Search index.

using CMS;
using CMS.DataEngine;
using CMS.Search.Azure;
using CMSApp.SiteModules;
using System.Collections.Generic;

[assembly: RegisterModule(typeof(CustomAzureSearchModule))]

namespace CMSApp.SiteModules
    public class CustomAzureSearchModule : Module
        public CustomAzureSearchModule() : base("CustomAzureSearch")


        protected override void OnInit()
            SearchServiceManager.CreatingOrUpdatingIndex.Execute += AddCorsToIndex;

        private void AddCorsToIndex(object sender, CreateOrUpdateIndexEventArgs e)
            Microsoft.Azure.Search.Models.Index index = e.Index;

            index.CorsOptions = new Microsoft.Azure.Search.Models.CorsOptions();
            index.CorsOptions.AllowedOrigins = new List<string>()


This was done on Kentico 12, and needs to be added to the Admin side.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.