【发布时间】:2017-05-15 00:06:06
【问题描述】:
我尝试将响应标头添加到仅提供的一个位置路径,并且 nginx 配置看起来像
server {
...
add_header x-test test;
location /my.img {
rewrite ^/my.img$ /119.img;
add_header x-amz-meta-sig 1234567890abcdef;
}
}
但只有顶级标题(x-test)有效,位置指令中的那个不显示,如图所示
$ curl -v -o /tmp/test.img 'https://www.example.com/my.img'
< HTTP/1.1 200 OK
< Server: nginx/1.9.3 (Ubuntu)
< Date: Sun, 14 May 2017 23:58:08 GMT
< Content-Type: application/octet-stream
< Content-Length: 251656
< Last-Modified: Fri, 03 Mar 2017 04:57:47 GMT
< Connection: keep-alive
< ETag: "58b8f7cb-3d708"
< x-test: test
< Accept-Ranges: bytes
<
{ [16104 bytes data]
如何仅为提供的特定文件发回自定义headrr。
【问题讨论】:
标签: nginx nginx-location