CORS issue - seems it cannot read .htaccess — CyberPanel - WebHosting Control Panel for OpenLiteSpeed

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.

https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:config:cors

The .htaccess file in question looks like:

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

Comments

  • edited October 8
    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/example.com and go to the Configuration and vhostconf.

    Note that the file indicated on this docs https://openlitespeed.org/kb/setting-up-cors-on-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/example.com
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion