# Code highlighting failed because bunny.net CDN

**URL:** https://meta.discourse.org/t/code-highlighting-failed-because-bunny-net-cdn/296333
**Category:** Support
**Tags:** cdn, cors
**Created:** [February 22, 2024, 3:00pm UTC](https://meta.discourse.org/t/code-highlighting-failed-because-bunny-net-cdn/296333 "2024-02-22T15:00:50Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [March 8, 2024, 10:49am UTC](https://meta.discourse.org/t/code-highlighting-failed-because-bunny-net-cdn/296333/4 "2024-03-08T10:49:45Z")

</div>

The change which made this noticeable was most likely [DEV: Modernise highlightjs loading (#24197) · discourse/discourse@0878dde · GitHub](https://github.com/discourse/discourse/commit/0878dde2132a34ba2787e702de222bc6dd161895), which switched highlightjs to load via native `import()`, which requires CORS headers when fetching from a CDN.

But even before that change, you likely would have had some issues with things like custom Fonts (which also require CORS headers for cross-origin requests).

In theory, Discourse itself should be adding the CORS header to CDN responses. If it’s not, that probably means your CDN is not setting the CDN hostname (i.e. not the forum hostname) in the `Host` header or the `X-Forwarded-Host` header.

That said, adding the headers via the CDN config likely achieves the same thing 👌

---

_[View the full topic](https://meta.discourse.org/t/code-highlighting-failed-because-bunny-net-cdn/296333)._
