wantguns / bin

highly opinionated, minimal pastebin
https://basedbin.fly.dev
GNU Lesser General Public License v3.0
213 stars 20 forks source link

Provide Last-Modified headers (or Etag) #3

Closed NoraCodes closed 2 years ago

NoraCodes commented 2 years ago

We should provide a Last-Modified header which pulls its value from the paste file modification time (for pastes) or from the binary's compilation date (for CSS, JS, etc). This would allow CDN caches to revalidate simply by checking the Last-Modified date without actually transferring the body of the paste - especially good for images or large files accessed periodically.

Alternately we could provide an Etag header pulling from the current Git commit hash for CSS and JS, and from a cryptographic digest of the paste file for pastes.

wantguns commented 2 years ago

Adding that header was up on my todo list after I ran the lighthouse test on the site. I did not know about the Etag header, that would be really neat.

I am a little busy right now, will work on it after a day or two.

NoraCodes commented 2 years ago

No worries - if you don't get to it, I'll probably have some time soon. I just wanted to put in an issue so I remember

NoraCodes commented 2 years ago

Addressed in #5