访问控制允许原始标题问题

时间:2017-02-11 04:10:53

标签: apache cors httpd.conf

我在将CORS标头设置为配置文件httpd.conf时出现问题。

我已按照文档和堆栈溢出帮助中的说明进行操作。

这是我到目前为止所做的事情:

1)检查标题模块(确保它已取消注释)

LoadModule headers_module modules/mod_headers.so

2)在httpd.conf中设置原始允许的CORS标头

<Directory "C:/xampp/htdocs/projects">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
Require all granted

#
# Allowing CORS Header Access Control Allow Origin
#
Header set Access-Control-Allow-Origin "*" --- **Added This line here**
</Directory>

3)使用GUI重启Windows Apache

我一直收到这个错误:

No 'Access-Control-Allow-Origin' header is present on the requested resource.

Googling-fu的上述建议似乎根本不起作用。非常感谢您的帮助!

编辑:修正了格式

0 个答案:

没有答案