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

后端 未结 2 2010
佛祖请我去吃肉
佛祖请我去吃肉 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条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-28 19:28

    You have to enable the headers module first, like so :

    • click on the wamp icon in your systray
    • go to Apache > Apache modules
    • check the option 'headers_module'

    And then include this in your apache config:

    
        Header set Access-Control-Allow-Origin: *
    
    

    (in httpd.conf or in the configuration of your vhost)

    (Instead of the * you can also specify a specific domain)

提交回复
热议问题