https://www.growthbook.io/ logo
b

breezy-megabyte-18851

03/05/2023, 1:03 PM
Hey! I was wondering if anyone tried implementing Growthbook while using Varnish in front of the application server, whilst keeping the logic server side, I’m having trouble to conceptualise it.
f

fresh-football-47124

03/06/2023, 4:57 AM
Hi Robinero - That may be possible, but knowing when to update the cache would have to be figured out
alternatively, you can use our GrowthBook Proxy to achieve a similar effect
b

breezy-megabyte-18851

03/06/2023, 8:38 AM
Hey Graham, the proxy acts as a Growthbook instance with a cached output, right? In my case the Varnish server would be in front of the application that’s going to be feature toggled, sort of like Fastly.
f

fresh-football-47124

03/06/2023, 8:45 PM
@happy-autumn-40938 any insights on how Robinero could do this? ^
h

happy-autumn-40938

03/06/2023, 9:21 PM
I don't think the GrowthBook Proxy directly addresses this. Generally speaking though, you'd probably want to either set a short enough TTL that cache doesn't stay stale for too long, or rig up a cache
ban
or
purge
trigger on your Varnish server whenever features change. You could technically use a GrowthBook webhook to hit some sort of listener on your infrastructure (varnish server directly, lambda, etc) that would handle the cache purge.
One other option that is far more experimental would be installing a GB SDK in front of your cache server (like as a CDN / edge worker). We don't officially support this at the moment, but you may have some success here.
b

breezy-megabyte-18851

03/07/2023, 5:50 PM
Hey, thanks for getting back to me! It’s not so much the ‘when will caches need to be purged’, but rather the ‘how does Varnish know which page to serve’, all the while keeping the flexibility GB provides. I’m leaning in the run a separate GB SDK direction, throw a unique ID at it, and let it return some flags to query on inside Varnish.
Gonna require a bit of tinkering, but might just be the way to go.
19 Views