开发者

nginx status code 200 and 304

开发者 https://www.devze.com 2023-02-28 16:04 出处:网络
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 see

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 n开发者_StackOverflowginx 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?


Try this.

if (...){
    expires max;
    add_header Last-Modified $sent_http_Expires;
    break;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号