nginx 状态码 200 和 304
我正在使用 nginx + 乘客。我试图理解 nginx 响应 200 和 304。这两者意味着什么?有时,它会返回 304,而其他的则仅返回 200。阅读 YUI博客,看来浏览器需要标头“Last-Modified”来与服务器验证。我想知道为什么浏览器需要验证最后修改日期。这是我的 nginx 配置:
location / {
root /var/www/placexpert/public; # <--- be sure to point to 'public'!
passenger_enabled on;
rack_env development;
passenger_use_global_queue on;
if ($request_filename ~* ^.+\.(jpg|jpeg|gif|png|ico|css|js|swf)$) {
expires max;
break;
}
}
How will I add header "Last-Modified" to the static files?我应该设置哪个值?
I'm using nginx + passenger. I'm trying to understand the nginx response 200 and 304. What does this both means? Sometimes, it responses back in 304 and others only 200. Reading the YUI blog, it seems browser needs the header "Last-Modified" to verify with the server. I'm wondering why the browser need to verify the last modified date. Here is my nginx configuration:
location / {
root /var/www/placexpert/public; # <--- be sure to point to 'public'!
passenger_enabled on;
rack_env development;
passenger_use_global_queue on;
if ($request_filename ~* ^.+\.(jpg|jpeg|gif|png|ico|css|js|swf)$) {
expires max;
break;
}
}
How would I add the header "Last-Modified" to the static files? Which value should I set?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个。
Try this.