1
Fork 0
mirror of https://github.com/RGBCube/Site synced 2025-07-31 13:07:46 +00:00

blog(nginix): fixes

This commit is contained in:
RGBCube 2025-06-09 15:27:23 +03:00
parent e3f64ceae5
commit 74f71612a1
Signed by: RGBCube
SSH key fingerprint: SHA256:CzqbPcfwt+GxFYNnFVCqoN5Itn4YFrshg1TrnACpA5M
4 changed files with 45 additions and 33 deletions

View file

@ -82,7 +82,7 @@ change the size of its contents? (more common than you think)
> derived from its inputs] to `1`, which corresponds to January 1st, 1970,
> 00:00:01 UTC.
In that case, neither the last modified date or the content length would same.
In that case, neither the last modified date or the content length would change.
So the `ETag` header would stay **constant, which would make the client assume
the asset has not changed**.
@ -212,7 +212,7 @@ The way this works is as follows:
3. Save the current value of `errno` (ugh) to a local.
4. Then try to resolve `clcf->root.data`. `clcf->root.data` is the path
4. Then we try to resolve `clcf->root.data`. `clcf->root.data` is the path
specified in the root directive of the Nginx configuration and could be a
symbolic link (e.g., it could be `/var/www` which might be a symlink to a Nix
store path[^Please don't do this.]). `ngx_realpath` resolves all symbolic
@ -230,8 +230,8 @@ The way this works is as follows:
7. **The main condition:** We check if the `r->headers_out.last_modified_time`
is `1`, which is what Nix sets file's last modified times to, we then check
if the canonical path resolution has succeeded (`real != NULL`), if the
canonical path starts with the Nix store path (`NIX_STORE_DIR`), and if it
has anything file after it (`@[next] != '/' && @[next + 1] != NULL`).
canonical path starts with the Nix store path (`NIX_STORE_DIR`), and if the
store path has anything after it (`@[next] != '/' && @[next + 1] != NULL`).
8. (If the condition is true) We then extract the hash. A path like
`/nix/store/6bxcxc6xvg5xv70z55adcwhgik5m41a0-package-1.0.0/bin/package` gets
@ -261,3 +261,5 @@ unit).] issues.
I hope you learned something in this blog post, and perhaps a new way to
fingerprint Nginx installs :).
![Nixpkgs built Nginx-served ETag header](/assets/images/nixpkgs-nginx-etag.webp)