I have about 15gb of files sitting on a website that were very rarely getting accessed, but taking up space on my server. So I had the idea to move them to a storage zone on Bunny.net (formerly Bunny CDN), as I’ve got an account with a grandfathered plan that only costs me $10 per year, and I’m barely using any of the credits.
Although these files aren’t very sensitive, I still don’t want them showing up in Google’s search results. The easiest way to tell search engines to go away is to add a noindex tag, and we can very easily do this using Bunny.net’s ‘Edge Rules‘.
When you have your ‘Storage Zone‘ and ‘Pull Zone‘ set up, click on ‘CDN‘ in the left menu, and click on the pull zone you have set up. Select ‘Edge Rules‘ from the menu.
Create a new rule, call it whatever you want. Under ‘Actions‘ choose ‘Set Response header‘. For the ‘Header Name‘ type ‘X-Robots-Tag‘. For the ‘Header Value‘ type ‘noindex‘.
Under the ‘Conditions‘ section, this is where you apply where you want this rules to apply. In my case I wanted everything and anything in my storage zone to have the noindex applied to it. So I just added my storage zone URL with a slash and a star to indicate a wildcard rule. However you can get as precise as you want, it’s super flexible.
To check whether the tag has been implemented, load a file inside the storage zone in your website browser. Open your browser’s developer tools, for most browsers you can access it by pressing ctrl+shift+i. Click the ‘Network‘ tab and then refresh the page. Click the file name your testing in the left column under ‘Name‘. Under the ‘Headers‘ tab scroll down until you see ‘Response Headers‘. Scroll until you find ‘X-Robots-Tag‘ and ensure the value is set to ‘noindex‘.
Congratulations, you have successfuly noindexed a Bunny.net storage zone.