Cloudflare Worker blocked by Bunny CDN due to missing Referer / How to set Referer header in fetch

hello all ! I’m using Bunny CDN with referrer-based protection enabled to serve images. I’m generating Open Graph (OG) images with https://nuxt.com/modules/og-image using the Cloudflare Worker, which fetches those protected images. However, Bunny seems to block these requests, because the Worker doesn’t include a valid Referer header. I'd like to ensure that all outgoing requests from the Worker to Bunny CDN include a specific Referer so they aren’t blocked. How can I configure the Worker to explicitly set a Referer header when fetching these protected resources ? I could override and make sure it works at a global scope. Thanks ! Gabriel
Nuxt
nuxt-og-image · Nuxt Modules
Enlightened runtime images generated with Vue templates.
2 Replies
kapa.ai
kapa.ai4w ago
Hi @gabrielstuff. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry, but the provided knowledge sources do not contain explicit information about configuring a Cloudflare Worker to set or override the Referer header when making fetch requests to Bunny CDN. The Nuxt documentation and related sources do cover how to forward and manipulate headers in server-side fetches within Nuxt apps (using composables like useFetch, useRequestFetch, and event.$fetch), and they mention which headers are forwarded or blocked for security reasons. However, there is no direct guidance or example for setting the Referer header in a Cloudflare Worker context, nor for global header overrides in that environment. The Bunny CDN integration documentation for Nuxt Image also does not address this scenario. If you need to set the Referer header in a Cloudflare Worker, you may need to consult the Cloudflare Workers documentation or Bunny CDN's own documentation for handling referrer-based protection, as this is outside the scope of the Nuxt documentation and modules referenced here. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai4w ago
<@213659913149218817> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?