我有多个网址需要使用Nginx添加相同的标头集.这是文件名.
File Group1
https://www.example.com/news/2017-08-03/article-xyz/
https://www.example.com/news/2017-08-03/article-xyz/topics/
https://www.example.com/news/2017-08-03/article-xyz/gallery/
File Group2
https://www.example.com/news/2017-08-02/article-abc/
https://www.example.com/news/2017-08-02/article-abc/topics/
https://www.example.com/news/2017-08-02/article-abc/gallery/
所以在这种情况下,文件组1需要:
add_header Cache-Tag article-xyz;
而文件组2需要:
add_header Cache-Tag article-abc;
所以Nginx.conf应该是这样的
location /news/ {
add_header Cache-Tag article-abc;
}
但是如何在添加标头中动态应用它?
最佳答案