Kendall Hopkins asked:
Is it possible to have Nginx cache all
301 redirect requests for
Request #1: Client A requests /some/path -> sent to
proxy_pass -> results in 301 redirect to
/some/other/path -> nginx caches this response since it’s a 301 redirect.
Request #2: Client B requests /some/path -> nginx returns cached 301 redirect to
nginx already can cache 301 redirects. You can change the amount of time they are cached with the proxy_cache_valid directive:
proxy_cache_valid 301 365d; # Cache permanent redirects for a whole year
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.