如何解决nginx如何从`x-accl-redirect`转发fcgi的`Content-Security-Policy`标头?
问题:
我有一个 fcgi 应用程序 (php) 发送标头
Content-Security-Policy: sandbox;
Content-Type: foobar
X-Accel-Redirect: /test
由于某种原因,nginx 正在转发 Content-Type
标头,但它没有转发 Content-Security-Policy: sandbox;
标头
我的php源代码是:
<?php
header("Content-Security-Policy: sandbox;");
header("Content-Type: foobar");
header("X-Accel-Redirect: /test");
并且 test
文件包含:testcontent
当我用 curl -v
击中它时,我得到:
$ curl paste.lan:81/test.php -v
* Trying 127.0.0.1:81...
* TCP_NODELAY set
* Connected to paste.lan (127.0.0.1) port 81 (#0)
> GET /test.php HTTP/1.1
> Host: paste.lan:81
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Server: nginx/1.18.0 (Ubuntu)
< Date: Sun,21 Feb 2021 14:26:35 GMT
< Content-Type: foobar
< Content-Length: 12
< Last-Modified: Sun,21 Feb 2021 14:26:00 GMT
< Connection: keep-alive
< ETag: "60326d78-c"
< Accept-Ranges: bytes
<
testcontent
* Connection #0 to host paste.lan left intact
那么,知道为什么 nginx 不转发 Content-Security-Policy
标头吗?或者如何解决?
解决方法:
add_header Content-Security-Policy $upstream_http_content_security_policy;
我不知道为什么我必须用 Content-Security-Policy
而不是 Content-Type
但哦好吧...
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。