<div class="grid--cell fl1 lh-lg">
<div class="grid--cell fl1 lh-lg">
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, <a href="/help/reopen-questions">visit the help center</a>.
</div>
</div>
</div>
<div class="grid--cell mb0 mt8">Closed <span title="2012-07-28 14:33:24Z" class="relativetime">7 years ago</span>.</div>
</div>
</aside>
I'm using nginx for proxy cache and I'm having trouble to make it cache some ajax requests. Nginx are making cache correctly for all pages but not for ajax requests.
The uri for ajax requests are like: /process/leaveyourmessage/getMessages?id=XX
My location config is:
location / {
proxy_pass http://mydomain.com:8080;
proxy_cache microcache;
proxy_cache_valid 200 5s;
proxy_cache_use_stale updating;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
On the http block I've added:
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
Anyone know what could be the problem? My back end is apache + php
I've found the problem. Nginx respect cache-control and expires header and those ajax was sending it.
Writing down "proxy_ignore_headers Cache-Control Expires;" made it work.
</div>