我应该在哪里设置HTTP标头,例如Expires? [英] Where should I set HTTP headers, such as Expires?

查看:341
本文介绍了我应该在哪里设置HTTP标头,例如Expires?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Phusion Passenger w / nginx上使用Sinatra部署应用程序。如果我想在我的静态内容 - 样式表上设置Expires标题,比如说 - 似乎有三个地方我可以完成这个。

I want to deploy an app using Sinatra on Phusion Passenger w/ nginx. If I want to set the Expires header on my static content - stylesheets, say - there are appear to be three places where I could accomplish this.


  1. 在我的Sinatra应用程序中,使用API​​

  2. 使用Rack中间件

  3. 在我的部署的服务器配置中

这些方法中哪一个是设置HTTP标头的最佳位置?

Which of these methods is the best place for setting HTTP headers?

推荐答案

在谈话之后回答这个问题看到上面的评论,我想我已经找到了自己问题的答案。

After talking though and answering this question and seeing the comment above, I think I have figured out the answer to my own question.

nginx的重点实际上删除了前两个选项。

The whole point of nginx actually removes the first two options.

这导致选项#3。这是设置所有其他内容配置的地方,例如gzip压缩。

That leads to Option #3. This is where all the other content config is set, such as gzip compression.

这篇关于我应该在哪里设置HTTP标头,例如Expires?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆