Backend selection based on integer value in request?

Ross Brown ross at trademe.co.nz
Wed Oct 10 02:42:22 CEST 2012


Hi all

We use Varnish for accelerating images. They are uploaded by our users and given a numeric ID, which is allocated sequentially. We have a lot of them.

I'm about to start storing newly-uploaded in a different place, and ideally would like to select a backend by doing a compare against the image ID, eg if the ID > a number, use a different backend. Otherwise the backend will have to check both storage locations to find the image.

I could do this with a regex, but ideally I'd like to do a proper integer comparison. I have read about the integer function in vmod_std, but I don't see how I use that when the integer is part of the request URL.
https://www.varnish-cache.org/docs/3.0/reference/vmod_std.html?highlight=vmod_std#integer

Request URLs look similar to this: /photoserver/size/1234567.jpg

Any ideas?




More information about the varnish-misc mailing list