Many thanks Francis!
Here are my configs, I'm using Nginx as a reverse proxy server to cache static files from its upstream servers.
+++++++++++++++++++++++++++++++++++
proxy_temp_path /tmp/proxy_temp_dir;
proxy_cache_path /tmp/proxy_cache_dir levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g;
upstream backend_server {
server myserver01 weight=1 max_fails=2 fail_timeout=15s;
server myserver02 weight=1 max_fails=2 fail_timeout=15s;
}
server {
listen 80;
server_name test.stg
root html;
index index.html index.htm;
charset utf-8;
location / {
proxy_next_upstream http_502 http_504 error timeout invalid_header;
proxy_cache cache_one;
proxy_cache_valid 200 304 12h;
proxy_cache_key $host$uri$is_args$args;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Connection "";
proxy_pass http://backend_server;
proxy_http_version 1.1;
expires 1d;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
+++++++++++++++++++++++++++++++++++ END
I'm trying to implement a smart way to purge cache e.g. by touching the file to change its etag. This needs the HTTP/1.1 support. But per my tests, Nginx does not return expected value.
$ curl -I -H 'If-None-Match: "9cx7b1-x2e-44xa4x9axd0x0"' http://test.stg/crossdomain.xml
This command gives 200 OK return code, but if I use Varnish instead, it gives the expected value 304 Not Modified.
So I'm wondering that it may be caused by the protocal between Nginx and the upstream server.
Can you help have another check. Appriciated!