在 Windows 8 上使用 wamp 启用 CORS [英] Enable CORS with wamp on windows 8
问题描述
我正在执行的应用程序存在跨域请求问题.我真的花了几个小时寻找有关如何使用 wamp (localhost) 启用 CORS 的解决方案,但对我来说没有任何效果.
I have a cross domain request problem with an application I'm doing. I really spent hours looking for a solution on how to enable CORS with wamp (localhost) but nothing worked for me.
我在 Windows 8.1 上安装了 Apache 2.4.9.我启用了标题,我试着把
I have Apache 2.4.9 on Windows 8.1. I have enable the headers, I tried to put
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"
在 .htaccess 和 http.conf 以及无数其他变体中.
in a .htaccess and in the http.conf as well as countless other variations.
如果有人有一个很棒的解决方案!
If anyone had a solution that'd be awesome!
推荐答案
您还必须激活 Apache Headers 模块.
You must also activate the Apache Headers module.
使用 wampmanager 菜单执行此操作:-
Using the wampmanager menus do this :-
wampmanager -> Apache -> Apache modules -> headers_module
确保勾选此项,如果未勾选,请单击该菜单项并等待几秒钟,WampServer 将重新启动 Apache.
Make sure this is ticked, if its not, click that menu item and wait a few seconds while WampServer restarts Apache.
这篇关于在 Windows 8 上使用 wamp 启用 CORS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!