2015-12-02 100 views
-1

我在Windows Server 2012上运行Apache Tomcat。我所做的只是下载zip文件,在桌面上打开它,然后从那里启动/停止所有操作。Apache Tomcat配置文件,Windows Server 2012,未作为服务运行

我想访问一些运行在我的开发机器上的JavaScript程序在服务器上运行的Web服务。我的开发机和服务器运行的Apache未在同一网络上,我收到以下错误:

XMLHttpRequest cannot load service-call-snipped-for-brevity Response 
to preflight request doesn't pass access control check: 
No 'Access-Control-Allow-Origin' header is present on the 
requested resource. Origin 'http://localhost:8080' is 
therefore not allowed access. 

我读过,我来补充:

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

到的httpd。 conf文件,并在apache install conf dir中创建它(记住apache是​​通过将下载的zip文件解压到我的桌面“安装”的),如果它不存在,我可以创建它。

非常好!

除了当我这样做并重新启动Apache Tomcat时,我仍然得到相同的错误。

我错过了什么?

+1

阿帕奇_Tomcat_不使用httpd.conf中,Apache的_Webserver_一样。 http://enable-cors.org/server_tomcat.html – Marged

+0

可能的重复[如何在Apache Tomcat中启用CORS](http://stackoverflow.com/questions/22526146/how-to-enable-cors-in-apache -tomcat) – Marged

+0

@已限制我如何标记你的答案是正确的? –

回答

相关问题