CDN Settings Page .htaccess Modification Problem




Wordpress LScache Plugin: CDN Settings Page .htaccess Modification Problem

Last Updated on: Wed, 15 Apr 2026 00:00:02
Ive spent the last couple of days trying to get my StackPath CDN working with LiteSpeed Cache WordPress plugin via your CDN Settings page. Ive finally found a combination of settings that work, but I need to stop your plugin from adding the following section to my .htaccess file every time I save the plugin settings. ### marker CORS start ### Header set Access-Control-Allow-Origin ### marker CORS end ### Without this entry, things are working fine, but Chrome stops loading web fonts and displays multiple errors like the one below as soon as the above entry is added to .htaccess. Access to font at https://cdn.martinbaileyphotography.com/wp-content/plugins/social-warfare/assets/fonts/sw-icon-font.woff?ver=3.6.1&#8217 from origin https://martinbaileyphotography.com&#8217 has been blocked by CORS policy: The Access-Control-Allow-Origin header contains multiple values , , but only one is allowed. Would it be possible to add a checkbox to the settings that can be turned off for anyone that does not want the .htaccess file to be updated when saving settings? Or are you aware of any other way that I could safely stop this from happening without having to update code every time an update to your plugin is released? Thanks in advance for any help or advice you can provide. The page I need help with: https://martinbaileyphotography.com/ Hi, Is that marker CORS block currently removed in your htaccess? Best regards, Yes it is removed, as it causes errors on my site. I just need to stop it from being readded when I save the CDN settings in your plugin. Hi, If check any resources that is come from CDN , like this screenshot https://i.imgur.com/sLV7BGk.jpg you will see Access-Control-Allow-Origin: header this means , there is something else in somewhere that sends this header which duplicated with LSCWP one, you should remove it and only use the only generated by LSCWP. Best regards, Ideally, I agree, but none of the other plugins are adding this to .htaccess, neither are they adding it only for fonts. If I remove it from the other settings, I lose that header for all other file types, and that is not acceptable. Also note that ideally Id prefer to add my own website address instead of as the wildcard is the worst option security-wise, but if I add my domain the error still occurs because with your added block I still have two entries and Chrome doesnt allow that. Hi, If you compare the origin font and CDN font, like this screenshot https://i.imgur.com/ebFJxf8.jpg If that header is set in origin , it should show in origin URI as well , but in this case it doesnt , which believes me this header is added by CDN setting , please check your StackPath console if there is any edge rule or something that adds this CORS header Yes , you have good point for the wildcard , will talk to devs to make it configurable or automatically applies with origin domain. but still , you need to first , to get rid of the header at CDN level. Best regards, I was adding the header by the CDN, as that was the only way I could get it to work before using LiteSpeed, but on your advice, I just removed it from the StackPath settings, and put it back into my .htaccess but using my domain, not , which is how I would prefer it to be set up. I then also went back and saved the settings on your plugins CDN page, and although the block above is back, along-side my own header adding my domain, at this point, it seems to be working fine! Ive flushed my caches etc. so it seems that this was the key, so thank you! Ill keep my eye on this, but now Im wishing I mentioned this three days ago when I started struggling with this issue. Thanks again! Good to know it works now Dont hesitate to contact us again if you have any furhter issues Best regards,



LiteCache Rush: Speed comes from using less, not from doing it faster



Reference