【发布时间】:2018-10-27 10:54:44
【问题描述】:
我在.htaccess 中加入了以下几行:
#Header set Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"#
我可以在http://www.example.com 上运行带有套接字 io 应用程序的节点 js,但是当我尝试在 https://www.example.com 上运行时
我收到"Access-Control-Allow-Origin" header is present on the requested resource 的错误。我尝试在 CentOS 上创建一个虚拟主机,托管在 /etc/httpd/conf.d/httpd.conf 的 Apache Web 服务器上。当我打开一个像 3000 这样的非标准端口并监听它时,运行“端口已在使用”时出现错误。我该怎么办?
【问题讨论】:
标签: javascript node.js apache socket.io virtualhost