Hi,
Was hoping someone could help us setting up a rule in .htaccess for CORS policy for Access-Control-Allow-Origin.
We found a bunch of posts on StackOverflow relating to this, all with the same general proposed solution.
We implemented the accepted solution trying a variety of variations .... but none seemed to work.
None of those posters appeared to be running LiteSpeed, so we're not sure if that's the issue and there's something we need to do slightly differently. We're running LS Enterprise 5.2.5 (build 2).
Here's the rule....
We have 3 domains all pointing to the same IP and directory where the .htaccess is located.
If we remove the SetEnvIf line and just use:
... it works just fine. It appears to be something with the syntax of the SetEndif line that LiteSpeed does not like.
Please note: I used domain1,2,3 for posting purposes due to privacy reasons ... the rule on the server is using the actual domain names.
Any help is much appreciated. Been fighting with this one for hours.
Thanks.
John
Was hoping someone could help us setting up a rule in .htaccess for CORS policy for Access-Control-Allow-Origin.
We found a bunch of posts on StackOverflow relating to this, all with the same general proposed solution.
We implemented the accepted solution trying a variety of variations .... but none seemed to work.
None of those posters appeared to be running LiteSpeed, so we're not sure if that's the issue and there's something we need to do slightly differently. We're running LS Enterprise 5.2.5 (build 2).
Here's the rule....
Code:
SetEnvIf Origin "^http(s)?://(.+\.)?(domain1\.com|domain2\.com|domain3\.com)$" origin_is=$0
Header always append Access-Control-Allow-Origin %{origin_is}e env=origin_is
Code:
curl -I domain1
curl -I domain2
curl -I domain3
Code:
Header always append Access-Control-Allow-Origin domain1
Please note: I used domain1,2,3 for posting purposes due to privacy reasons ... the rule on the server is using the actual domain names.
Any help is much appreciated. Been fighting with this one for hours.
Thanks.
John
Last edited by a moderator: