Setting Up Cross Browser Support for Multiple Domains in .htaccess

Paul Konstanski
Paul Konstanski used Ask the Experts™
on
I am running a number of api scripts off of a single server. A number of outside sites access these scripts from different domains.

When I use this command, it works fine.

Header add Access-Control-Allow-Origin "http://example1.com"

My online research told me that this was the way to set up the .htaccess file for multiple domains, but it isn't working.

SetEnvIf Origin "^http(s)?://(.+\.)?(example1\.com|example2\.com | example3\.org)$" origin_is=$0
Header always set Access-Control-Allow-Origin %{origin_is}e env=origin_is


Can you provide assistance as to how this .htaccess file needs to be set up to provide cross browswer support?

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Project Specialist
Commented:
After some additional research, I found the answer:

http://stackoverflow.com/questions/20673882/handle-multiple-domains-with-access-control-allow-origin-header-in-apache

Look at the first answer offered by "George"

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial