I want to configure apache to allow XMLHttpRequests from multiple, but not all domains.
This works:
Header set Access-Control-Allow-Origin \"*\"
<
you can use SetEnvIf in your .htaccess file or in in vhost file (inside "Directory" group):
<IfModule mod_headers.c>
SetEnvIfNoCase Origin "https?://(www\.)?(mydomain\.com|mydomain2\.com)(:\d+)?$" AccessControlAllowOrigin=$0
Header set Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
</IfModule>
With this code you can allow access from
You can add multiple domains separated with | or you can use regexp to configure different subdomains or patterns.
Header always append Access-Control-Allow-Origin: "http://domain1.com"
Header always append Access-Control-Allow-Origin: "http://domain2.com"