未添加Access-Control-Allow-Credentials标头

时间:2017-06-08 09:58:16

标签: .htaccess cors

我想将Access-Control-Allow-Credentials: true添加到Apache 2.2服务器上的响应中。我的.htaccess文件看起来像这样。

SetEnvIfNoCase ORIGIN (.*) ORIGIN=$1
Header always add Access-Control-Allow-Origin "%{ORIGIN}e" env=ORIGIN
Header always add Access-Control-Allow-Methods "GET,POST,OPTIONS,DELETE,PUT"
Header always add Access-Control-Allow-Headers "Link, Location, Accept-Post, Content-Type, Slug, Origin"
Header always set Access-Control-Allow-Credentials "true"

RewriteCond %{HTTP_ACCEPT} text/turtle
RewriteRule ^/?$ https://example/me.ttl [R=303]

在第5行,我将标题Access-Control-Allow-Credentials设置为true。但是生成的响应对此标头有''。当我在文件末尾添加第5行时,产生以下内容

SetEnvIfNoCase ORIGIN (.*) ORIGIN=$1
Header always add Access-Control-Allow-Origin "%{ORIGIN}e" env=ORIGIN
Header always add Access-Control-Allow-Methods "GET,POST,OPTIONS,DELETE,PUT"
Header always add Access-Control-Allow-Headers "Link, Location, Accept-Post, Content-Type, Slug, Origin"
Header always set Access-Control-Allow-Credentials "true"

RewriteCond %{HTTP_ACCEPT} text/turtle
RewriteRule ^/?$ https://example/me.ttl [R=303]
Header always set Access-Control-Allow-Credentials "true"

Access-Control-Allow-Credentials的值为'true, true'。虽然我希望它只是'true'。 有人知道这种行为的原因是什么吗?

编辑:我已尝试将''放在第5行,以便最后得到'true',但之后我只得''

1 个答案:

答案 0 :(得分:0)

我联系了我的主机,虽然他们说他们身边没有任何问题,突然之间有效......

相关问题
最新问题