nuxt-hub / core

Build full-stack applications with Nuxt on CloudFlare, with zero configuration.
https://hub.nuxt.com
Apache License 2.0
937 stars 53 forks source link

Return Etag when serving images #142

Closed Barbapapazes closed 3 months ago

Barbapapazes commented 3 months ago

Hello 👋,

When using the hubBlob().serve(), https://github.com/nuxt-hub/core/blob/main/src/runtime/server/utils/blob.ts#L313, you could add the etag to the response headers to avoid the client browser to fetch a known image.

see this example https://developers.cloudflare.com/r2/api/workers/workers-api-usage/#4-access-your-r2-bucket-from-your-worker and this docs https://developers.cloudflare.com/r2/api/workers/workers-api-reference/#r2object-definition

atinux commented 3 months ago

I like the idea, happy to open a PR for it @Barbapapazes ?