Welcome! Log In Create A New Profile

Advanced

Re: Can't get a simple proxy to cache anything

Phil Endecott
January 24, 2021 07:58AM
Maxim Dounin wrote:
> You haven't configured any proxy_cache_valid directives (see
> http://nginx.org/r/proxy_cache_valid for details), and the
> response doesn't have any cache validity headers, such as
> "Expires" or "Cache-Control: max-age=...".

Thanks Maxim! It now seems to work.

I guess I was expecting the proxy_cache_path inactive=... time
to determine how long things were cached for. I think I have a
better understanding now. Let me check if I have this right:

The upstream server doesn't specify any Cache-Control or Expires
headers. It does supply an ETag and Last-Modified. I'd like to
cache these files for a long time (say 18 months), but revalidate
using the ETag (say after 5 minutes). So I have:

proxy_cache_path ... inactive=18M;
proxy_cache_revalidate on;
proxy_cache_valid 200 5m; # Beware M = Month, m = minute.

Is that right?

I have some other questions:

1. What proxy_cache_key should I be using? I am unsure of the difference
between e.g. host and proxy_host, and uri and request_uri. I currently
have

proxy_cache_convert_head off;
proxy_cache_key "$request_method$scheme$host$request_uri";

Do I need "$is_args$args" ?

2. Is there any way to indicate the cache status in the access log? I.e.
hit/miss/revalidated/uncachable etc.


Many thanks,

Phil.




_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Can't get a simple proxy to cache anything

Phil Endecott January 22, 2021 11:48AM

Re: Can't get a simple proxy to cache anything

Maxim Dounin January 23, 2021 10:16AM

Re: Can't get a simple proxy to cache anything

Phil Endecott January 24, 2021 07:58AM

Re: Can't get a simple proxy to cache anything

Maxim Dounin January 25, 2021 11:04AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 223
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready