> For the complete documentation index, see [llms.txt](https://bonusmastodon.aus.social/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bonusmastodon.aus.social/basics/static-content-cdn/bunny.net-cdn-pull-zone.md).

# Bunny.net CDN (Pull Zone)

## Stage 1: Setup Pull Zone&#x20;

### 1) Add new pull zone in Bunny.net

### 2) Create a unique name for the pullzone&#x20;

Example: `mastodoninstancestatic` or similar.

<figure><img src="/files/woPev23on9DIxfXLX5Hx" alt=""><figcaption></figcaption></figure>

### 3) Select `Origin Type URL`

### 4) Update **Origin URL**

Place the original FQDN of your instance in the Original URL.

<figure><img src="/files/X7LbAsFQnEI0DdgOcMQP" alt=""><figcaption></figcaption></figure>

### 5) Select your regions to replicate data

<figure><img src="/files/6ge5o9JO2RUSLKDxYHXA" alt=""><figcaption></figcaption></figure>

### 6) Add new Pull zone

## Stage 2: Configure Pull Zone.

### 1) Force SSL

<figure><img src="/files/e2rJ1XGRWiuG4uqjEJ0E" alt=""><figcaption></figcaption></figure>

### 2) Setup SafeHop (retries on failures)

<figure><img src="/files/20yQORyPsp9SjTwdi8PA" alt=""><figcaption></figcaption></figure>

### 3) Add additional Headers (CORS)

Add \`,js, gz\` to the Extension list.

Example: \`eot, ttf, woff, woff2, css, js, gz\`

<figure><img src="/files/TDAfgLIbM7oSaySaqDml" alt=""><figcaption></figcaption></figure>

## Stage 3: Configure Mastodon and NGINX

### 1) NGINX Headers

Add **`Access-Control-Allow-Origin`** header to nginx all locations.\
Example: `add_header Access-Control-Allow-Origin "https://aussocialstatic.b-cdn.net";`

<figure><img src="/files/hePqKFChjjWkDSK0qSEy" alt=""><figcaption><p>These paths are heavily used for static files... but the header might be required in multiple locations in the nginx conf</p></figcaption></figure>

### 2) Mastodon .env

Add `CDN_HOST` to .env.production&#x20;

Example: `CDN_HOST=https://aussocialstatic.b-cdn.net`

### 3) Reload nginx and restart mastodon.

## Troubleshooting

The OCR (Optical character recognition) might fail if you missed gz from the extension list.

<figure><img src="/files/UKEhnUIeMPdfFOn8XMoa" alt=""><figcaption></figcaption></figure>

## Notes

Do we need to add to svg to the CORs?


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://bonusmastodon.aus.social/basics/static-content-cdn/bunny.net-cdn-pull-zone.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
