简体   繁体   中英

set up php file to allow for cross domain calls

i am working with a server that has a boat load of unique ids

so full urls are as follows

http://football.myfantasyleague.com/ all the way to ----> http://football99.myfantasyleague.com/

http://www.myfantasyleague.com/ all the way to ----> http://www99.myfantasyleague.com/

i need to set permissions via php on a different server then the one shown above that will allow some ajax , jquery cross domain calls to the initial site that has all the multiple server ids

What would be a simple regex code to write to allow for the various servers and ids ?

Try this:

<IfModule mod_headers.c>
   SetEnvIf Origin "^(https?://(?:football|www)\d{1,2}\.myfantasyleague\.com/?)$" AccessControlAllowOrigin=$1
   Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
</IfModule>

Description

正则表达式可视化

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM