Since Postmill versions the filenames of all the CSS, JavaScript, SVG, and font files served, and all submitted images have their hashes as filenames, there's no point in serving 304s every browser reload because we know they're never going to change anyway. This way reloading will only load up the requested URI (which will most likely be a dynamic one anyway like /
or /f/meta
) and any new resources that an updated URI's resource links to. Less load for our server (since the browser will not request any immutable resource again) and faster reloading for the user!
I just noticed this while comparing the devtools network tab of Raddle and jstpst where the former does the immutable
trick (probably added by its Cloudflare CDN which we don't have) and therefore don't 304 its immutable resources on a browser reload.
An addition to the nginx config could look like this:
location ~ \.(jpg|gif|png|webp|css|js|svg|woff2)$ {
add_header Cache-Control "public, max-age=31536000, immutable";
}
nitori OP wrote
u/emma I wonder if this can also be done in Postmill proper so that sysadmins don't have to manually add the header themselves in their reverse proxies?