I'm running a nginx reverse proxy for speeding things up, I built it by source with ngx_pagespeed
. This works so far. I got several problems with browser caching.
Here is my location block:
location / {
expires 1y;
add_header Pragma public;
add_header Cache-Control "public";
index default.aspx
proxy_cache one;
proxy_pass http://xxxxxx.xxxx/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 180;
proxy_send_timeout 180;
proxy_read_timeout 180;
}
Images are always served with a expires header of "6 days", I tried it already with another location block (nested an unnested):
location ~* \.(js|css|png|gif|svg|svgz|woff|woff2|jpg|jpeg|gif|ico)$ {
expires 1y;
log_not_found off;}
I tried to figure out if the page speed module could set this header, but no luck so far. How can I do this?
I solved it by myself. It was a mess up between pagespeed and nginx cache. I disabled the nginx proxy cache and now it works.