CORS issue - seems it cannot read .htaccess

My website throws CORS error when running on VPS with Litespeed, but works fine on my local machine which uses Apache (MAMP).

It seems it is unable to read the .htaccess file.

Is there any special configuration that needs to be set up?

I read this documentation on OpenLiteSpeed, but that applies to the LiteSpeed admin.

The .htaccess file in question looks like:

    <IfModule mod_headers.c>
           <FilesMatch "\\.(pdf)$">
                Header set Access-Control-Allow-Origin "http://localhost:3000"

I have since found out that I should change the OSL config and did it as below.

I also rebooted the server after the change but THAT DID NOT SOLVE THE ISSUE.

Still getting no CORS headers.

on /usr/local/lsws/conf/vhosts/Example/vhconf.conf

context / {
allowBrowse 1
location $DOC_ROOT/
extraHeaders Access-Control-Allow-Origin *
rewrite {
RewriteFile .htaccess

By the way, it would be nice if one could format the code on this editor. It’s not such a difficult feature to implement.

Ok, I finally found I could change the config on /websites/ and go to the Configuration and vhostconf.

Note that the file indicated on this docs Guide to Setting Up CORS on OpenLiteSpeed • OpenLiteSpeed, or /usr/local/lsws/conf/vhosts/Example/vhconf.conf which I changed my comment above is NOT the file that actually is changed on /websites/