How to Enable CORS for your Website

The below steps will assist you in enabling CORS for your website hosted on our Windows shared hosting packages. 

 

  • Download your web.config file via FTP. 
  • Edit your web.config file and add the below code. 

 

  <configuration>
    <system.webServer>
      <httpProtocol>
        <customHeaders>
          <add name="Access-Control-Allow-Origin" value="*" />
        </customHeaders>
      </httpProtocol>
    </system.webServer>

Your web.config should look like the example below once done

  <?xml version="1.0" encoding="utf-8"?>
  <configuration>
    <system.webServer>
      <httpProtocol>
        <customHeaders>
          <add name="Access-Control-Allow-Origin" value="*" />
        </customHeaders>
      </httpProtocol>
    </system.webServer>
  </configuration>
  • Save the edited web.config file and upload this to your wwwroot folder for your website or the same location that it was downloaded from.
  • Ensure that any existing web.config file is overwritten. 
  • Browse your website again to test if this has worked. CORS should now be enabled for you. 
  • CORS, IIS
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How to reset or change your email password from SolidCP

Follow the steps below to change an email password that is hosted on our Windows SSD Hosting...

Email Password Complexity Requirements

For your security and the security of other users hosted on our Windows SSD Web Hosting...

How to Set Website Permissions + Write Permissions

How to set website write permissions using the Windows Hosting Control Panel. Log into the...

URL redirect rule to redirect all website traffic from http to https

This knowledgebase article applies to Windows Hosting only, below are the Linux instructions...

How to connect to your MSSQL databases from your website + using SQL Server Management Studio

How to remotely connect to a Microsoft SQL Database Preamble : In order to connect to a...