-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fileserver: Allow Etag override #5547
Conversation
5e93551
to
3818c6d
Compare
3818c6d
to
16ec924
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say this LGTM. Thank you!
FYI regarding your example, you can use backticks instead of double quotes to avoid needing to escape them. See the docs https://caddyserver.com/docs/caddyfile/concepts#tokens-and-quotes |
@charles-dyfis-net FYI there is also a slightly different approach in NixOS/nixpkgs#222354 |
This change strikes me as complimentary: if fileserver honors existing ETag values, a plugin can be used to set them so there's a cleaner way to use out-of-tree code to extract an ETag from the filesystem path. |
Hmm. There's something I don't understand here. Going back over the configuration I successfully tested it with, a closer approximation would be:
Note, two separate header blocks. If I combine them into a single header block as shown above, Etag is no longer set before file_server is invoked. |
Correct. If you remove a header it defers the operation until the response is written. The two header lines is the correct way to do it in your case where you need one set before the write. |
Ah! I didn't pay enough attention to where exactly the |
Yeah if you use |
I didn't even notice that in the original config. 😅 (I wonder if we should print a warning in the logs.) I like to think of it as: add first, delete later. |
Yup. I saw it in the docs, but read them to be saying that that individual operation would be deferred, as opposed to the whole batch. |
Gotcha. I'll try to clarify that. That might be a bug though. 🤔 I think I know why it is that way but I'm not sure if that's ideal/intentional. (Anyway, off-topic.) Is this good to merge then? |
I'm not aware of anything that should block merge. |
Fixes #5546
Tested with a Caddyfile with a form roughly resembling:
(with
${content-hash-here}
replaced with an actual hash rendered to base-16).