nuxt-modules / og-image

Generate OG Images with Vue templates in Nuxt.
https://nuxtseo.com/og-image
400 stars 25 forks source link

`Cache-Control: max-age` bug with cloudflare-kv-binding #104

Closed maximepvrt closed 11 months ago

maximepvrt commented 11 months ago

Describe the bug

@harlan-zw, After the new release that fixed the cache-control value (PR https://github.com/harlan-zw/nuxt-og-image/pull/102), the Nuxter website was updated by @Atinux.

However, I noticed that the max-age value is set 1000 times larger than expected. I have reviewed your repository, Nitro, and Unstorage, but unfortunately, I was unable to locate the source of this issue.

Capture d’écran 2023-10-28 à 14 38 49

Reproduction

No response

System / Nuxt Info

No response

harlan-zw commented 11 months ago

Thanks for the follow-up @maximepvrt, it seems like a bug in your PR that I missed, basically the cacheTtl time is a millisecond value, Cache-Control is configured with seconds, so we just need to / 1000.

Looking at this though I noticed there is some inconsistencies elsewhere, should hopefully be clearer https://github.com/harlan-zw/nuxt-og-image/commit/5fd812e9930d7f0a05522c0d346a49876f07caf2.