Skip to content

Instantly share code, notes, and snippets.

@THEtheChad
Created January 13, 2012 23:26
Show Gist options
  • Save THEtheChad/1609332 to your computer and use it in GitHub Desktop.
Save THEtheChad/1609332 to your computer and use it in GitHub Desktop.
Access-Control-Allow-Origin for Subdomains
SetEnvIf Origin "^(.*\.example\.com)$" ORIGIN_SUB_DOMAIN=$1
Header set Access-Control-Allow-Origin "%{ORIGIN_SUB_DOMAIN}e" env=ORIGIN_SUB_DOMAIN
@EOM
Copy link

EOM commented Jun 16, 2017

Gracias ;)
My Code End SubDomain http or https :

<IfModule mod_headers.c>
    SetEnvIf Origin "^(.*\.my-domain-root\.com\.ar)$" ORIGIN_SUB_DOMAIN=$1
    Header set Access-Control-Allow-Origin "%{ORIGIN_SUB_DOMAIN}e" env=ORIGIN_SUB_DOMAIN
#    Header set Access-Control-Allow-Credentials: true
    Header set Access-Control-Allow-Methods: "POST, GET"
#    Header set Access-Control-Allow-Methods: "*"
    Header set Access-Control-Allow-Headers: "Origin, X-Requested-With, Content-Type, Accept"
#    Header set Access-Control-Allow-Headers: "Origin, X-Requested-With, Content-Type, Accept, Authorization"
</IfModule>

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