アプリでHTTP_IF_MODIFIED_SINCEヘッダーを使用して、リソースが古くなっているかどうかを判断し、その場合は200/304をレンダリングしようとしています。私の開発環境では、すべてが正常に機能しますが、本番環境で機能させることはできません。
Passenger3.0.11とNginx1.0.13を使用しています。
以下に示すように、proxy_pass_header、proxy_set_header、passenger_pass_header、passenger_set_cgi_paramを試しました。最後のものは実際にはHTTP_IF_MODIFIED_SINCEヘッダーを設定しますが、それは空です...どんなヘルプ/アイデアも大歓迎です!
私の設定:
server {
listen 80 default_server;
root /home/rails/myapp/current/public;
passenger_enabled on;
charset utf-8;
proxy_pass_header If-Modified-Since;
proxy_set_header If-Modified-Since $http_if_modified_since;
passenger_pass_header If-Modified-Since;
passenger_set_cgi_param HTTP_IF_MODIFIED_SINCE $http_if_modified_since;
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html break;
}
location ~ \.(aspx|jsp|cgi)$ {
return 410;
}
location ~ ^/(assets)/ {
# http://guides.rubyonrails.org/asset_pipeline.html#server-configuration
# gzip_static on;
expires 1y;
add_header Cache-Control public;
add_header Last-Modified "";
add_header ETag "";
break;
}
}