Skip to content

Instantly share code, notes, and snippets.

Created Feb 15, 2013
What would you like to do?
Allowing Access-Control-Allow-Origin to multiple domains for Ajax requests
# source:
# - replace `` and ``
# - 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
Copy link

Tusko commented Nov 20, 2021


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment