Hello, long time Hugo user for my https://jamescampbell.us site. I am finally trying to optimize load times in NGINX and no matter what I do for the cache settings and cache headers, nothing is being recognized as being cache enabled. Is there a setting in HUGO to ensure this is correct? Thanks
Setting the cache HTTP headers has nothing to do with hugo, as that setup is specific to your server.
For example, here’s how I set
Cache-Control headers on Netlify (
## Cache Control # Paste the below in https://play.netlify.com/headers to test # Set max-age to 1 year (31536000 seconds) for stuff not expected to # update any time soon. [[headers]] for = "/css/*" [headers.values] Cache-Control = "public, max-age=31536000" [[headers]] for = "/js/*" [headers.values] Cache-Control = "public, max-age=31536000"
Hugo 0.43 onwards enables inbuilt fingerprinting (cache-busting). That in addition to the long cache timeouts you set in your HTTP headers might get the end result you want.
Thanks, I was more wondering if Hugo was somehow disabling cache by manually overwriting something, but it doesn’t appear to be. The headers settings for netlify look great, I am using digital ocean so manually reconfiguring NGINX to get it to work properly.