How do I make it work with Nginx?


I started using GrandCDN a few weeks back. My setup is basic, Nginx and PHP-FPM.

Until now I was using the IP method to detect whether the client downloading files was bunnyCDN. I had a “geo” block with the list of grandCDN IPs and used “if” to determine if I should rewrite URLs to * instead of my main domain for static files.

However the IPs have changed so much and it caused major issues to the clients, who couldn’t browse the site properly anymore.

I updated the list once, twice, but after 3 times the same week I just gave up.

I looked at the help page here:

I tried using CDN-ServerId like this:

if ($http_CDN-ServerId) {

// blah blah


but that did not work at all.

So now I’m wondering – how do I detect a regular visitor VS the bunnycdn servers?

thanks in advance for help

Leave a comment

Your email address will not be published. Required fields are marked *