Created
February 15, 2013 09:35
-
-
Save armno/4959387 to your computer and use it in GitHub Desktop.
Allowing Access-Control-Allow-Origin to multiple domains for Ajax requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: http://www.lowest-common-denominator.com/2010/01/http_access_control_to_multipl.php | |
# - replace `domain1.com` and `domain2.com` | |
# - add more domains by separating each domain with a pipe `|` | |
# - escape dot `.` with a backslash | |
<IfModule mod_headers.c> | |
SetEnvIf Origin "^http(s)?://(.+\.)?(domain1\.com|domain2\.com)$" origin_is=$0 | |
Header always set Access-Control-Allow-Origin %{origin_is}e env=origin_is | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!