Apache No';访问控制允许原点';标题
我试着在老问题之间搜索,但找不到如何解决我的问题 我有一个LF网站;一切都很好;当我继续时,我没有问题,firebug和/或chrome控制台上也没有显示错误 然后我配置了一个ApacheHTTP服务器。在我看来一切都是正确的,但当我尝试URL时,我看到了我的站点,但一些资源没有加载。在chrome控制台(还有firebug)中,我得到以下错误: 2(索引):已阻止来自源“”的1种字体 从跨源资源共享策略加载:否 “Access Control Allow Origin”标头出现在请求的服务器上 资源。因此,不允许访问源“” 我不知道如何解决这个问题。在我看来,这似乎是一个Apache配置错误。 这是我的虚拟主机配置:Apache No';访问控制允许原点';标题,apache,cors,Apache,Cors,我试着在老问题之间搜索,但找不到如何解决我的问题 我有一个LF网站;一切都很好;当我继续时,我没有问题,firebug和/或chrome控制台上也没有显示错误 然后我配置了一个ApacheHTTP服务器。在我看来一切都是正确的,但当我尝试URL时,我看到了我的站点,但一些资源没有加载。在chrome控制台(还有firebug)中,我得到以下错误: 2(索引):已阻止来自源“”的1种字体 从跨源资源共享策略加载:否 “Access Control Allow Origin”标头出现在请求的服务器上
<VirtualHost *:80>
#CORS
<Directory "/var/www/">
AllowOverride All
Order allow,deny
allow from all
</Directory>
# Always set these headers.
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Max-Age "1000"
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
# Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request.
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]
ProxyPass /c http://localhost:8080/c
ProxyPassReverse /c http://localhost:8080/c
ProxyPass /si http://localhost:8080/si
ProxyPassReverse /si http://localhost:8080/si
ProxyPass /image http://localhost:8080/image
ProxyPassReverse /image http://localhost:8080/image
ProxyPass /documents http://localhost:8080/documents
ProxyPassReverse /documents http://localhost:8080/documents
ProxyPass /html http://localhost:8080/html
ProxyPassReverse /html http://localhost:8080/html
ProxyPass /sprite http://localhost:8080/sprite
ProxyPassReverse /sprite http://localhost:8080/sprite
ProxyPass /combo http://localhost:8080/combo
ProxyPassReverse /combo http://localhost:8080/combo
ProxyPass / http://localhost:8080/web/mySimpleLog
ProxyPassReverse / http://localhost:8080/web/mySimpleLog
ErrorLog logs/mySimpleLog-error_log
CustomLog logs/mySimpleLog-access_log common
</VirtualHost>
#科尔斯
允许超越所有
命令允许,拒绝
通融
#始终设置这些标题。
标题始终设置访问控制允许原点“*”
Header始终设置访问控制允许方法“POST、GET、OPTIONS、DELETE、PUT”
标头始终设置访问控制最大期限“1000”
Header始终设置访问控制允许Header“x-requested-with、内容类型、来源、授权、接受、客户端安全令牌”
#添加了一个重写,以在每个选项请求上成功响应200次。
重新启动发动机
重写cond%{REQUEST_METHOD}选项
重写规则^(.*)$$1[R=200,L]
ProxyPass/chttp://localhost:8080/c
ProxyPassReverse/chttp://localhost:8080/c
ProxyPass/sihttp://localhost:8080/si
ProxyPassReverse/sihttp://localhost:8080/si
代理过程/图像http://localhost:8080/image
ProxyPassReverse/imagehttp://localhost:8080/image
代理通行证/文件http://localhost:8080/documents
ProxyPassReverse/documentshttp://localhost:8080/documents
ProxyPass/htmlhttp://localhost:8080/html
ProxyPassReverse/htmlhttp://localhost:8080/html
ProxyPass/spritehttp://localhost:8080/sprite
ProxyPassReverse/spritehttp://localhost:8080/sprite
代理传递/组合http://localhost:8080/combo
ProxyPassReverse/combohttp://localhost:8080/combo
ProxyPass/http://localhost:8080/web/mySimpleLog
ProxyPassReverse/http://localhost:8080/web/mySimpleLog
错误日志/mySimpleLog-error\u日志
自定义日志/mySimpleLog-access\u日志公用
在我看来一切都是正确的。。。我还有别的选择吗
你知道我哪里错了吗
多谢各位
Angelo您仅在端口80上设置CORS标头,但跨原点部分是从端口80到端口8080——您应该移动标头集。。。在虚拟主机上下文之外或在8080 vhost中复制它。您只在端口80上设置CORS标头,但跨源部分是从端口80到端口8080--您应该移动标头集。。。在虚拟主机上下文之外或在8080 vhost中复制它