Search code examples
iisfontshostingcross-site

Enable cross site access in OK Hosting?


I'm trying to download the bootsrap fonts from a container I have in a site hosted by OK Hosting. I can download the font manually but when using it in a CSS on a page hosted in another server, it fails because cross site access is disabled.

I know OK Hosting uses IIS but they give you a web based control panel.

How do I enable cross site access?


Solution

  • Ok, you just have to add a file called web.config at the root of your site with the following:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
     <system.webServer>
       <httpProtocol>
         <customHeaders>
           <add name="Access-Control-Allow-Origin" value="*" />
         </customHeaders>
       </httpProtocol>
     </system.webServer>
    </configuration>