Feature: Allow using inode in ETags
feature :gear:discussion :speech_balloon:
### Issue Details
It would be nice to be able to configure caddy to include file inodes when calculating ETags, similar to [Apache](https://httpd.apache.org/docs/current/mod/core.html#fileetag).
My use case involves serving static files from the nix store, (see https://github.com/NixOS/nixpkgs/pull/222354), where the files' modification times are always 1, per nix's reproducibility guarantees. In this case, caddy [skips ETag generation entirely](https://github.com/caddyserver/caddy/blob/6c675e29f87cbe7326983ddb6d739175119d394c/modules/caddyhttp/fileserver/staticfiles.go#L746) (https://github.com/caddyserver/caddy/issues/5548), which can cause caching problems where browsers fail to detect that files have changed. The currently recommended approach in the nix world seems to be to strip the `Last-Modified` header also, which forces browsers to re-fetch assets every time. This works, but leads to unnecessary overhead.
I think it would be nice if it were possible to configure caddy to still calculate ETags, based on file size and inode number, rather than skipping ETag generation entirely. Using inode number has some downsides, such as in load balancing scenarios, but would be very useful in single server cases.
### Assistance Disclosure
AI not used
### If AI was used, describe the extent to which it was used.
_No response_
2 条评论