how to allow ACCESS-CONTROL-ALLOW-ORIGIN aka cross-domain on wampserver

后端 未结 2 2011
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-28 18:41

XMLHttpRequest cannot load https://webservice.com?param=hahah. Origin http://{domain} is not allowed by Access-Control-Allow-Origin.

I get this when I try to make a

2条回答
  •  -上瘾入骨i
    2020-12-28 19:42

    Hope this will solve your problem -

    To add the CORS authorization to the header using Apache, simply add the following line inside either the , , or sections of your server config (usually located in a *.conf file, such as httpd.conf or apache.conf), or within a .htaccess file:

    For all requests -

    Header set Access-Control-Allow-Origin "*"
    

    For trusted hosts -

    Header set Access-Control-Allow-Origin "your-ip/domain-here"
    

提交回复
热议问题