Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible for Varnish to parse the hostname to determine which backend to use? I'd like to avoid having to do:

if (url = 'backend1') {
    set req.backend = backend1;
}

.. for all of them.

I'd like to be able to do something like this:

set req.backend = regsub(req.http.Host, "^.*([^.]+)\.mydomain\.com$", "\1");

.. but that doesn't work.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

No, that is not possible at the moment. You could use build scripts that build your varnish configuration automatically. The varnish developers are thinking about dynamic backend declaration possibilites, which would cover your use case. The dev is asking for comapnies that would use this feature, so you maybe want to tell him that you are interested ;-)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.