我应该在哪里设置 HTTP 标头,例如 Expires?
我想在带有 nginx 的 Phusion Passenger 上使用 Sinatra 部署一个应用程序。如果我想在静态内容(例如样式表)上设置 Expires 标头,那么似乎可以在三个地方完成此操作。
- 在我的 Sinatra 应用程序中,使用 API
- 和 Rack 中间件
- 在我的部署的服务器配置中
以下哪种方法是设置 HTTP 标头的最佳位置?
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.
- In my Sinatra app, using the API
- With Rack middleware
- In the server config for my deployment
Which of these methods is the best place for setting HTTP headers?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过交谈并回答这个问题并看到上面的评论,我想我已经找到了我自己问题的答案。
nginx 的全部意义实际上是删除了前两个选项。
这就引出了选项#3。这是设置所有其他内容配置的地方,例如 gzip 压缩。
After talking though and answering this question and seeing the comment above, I think I have figured out the answer to my own question.
The whole point of nginx actually removes the first two options.
That leads to Option #3. This is where all the other content config is set, such as gzip compression.