How to match domains starting with "admin"

Paul A. Procacci pprocacci at
Mon Jul 9 21:47:36 CEST 2012

On Mon, Jul 09, 2012 at 09:57:38AM -0700, Abraham Cruz Sustaita wrote:
>    I have several sites on my servers, so I need to configure one admin
>    subdomain for each one. However, I don't want to make:
>    if (req.http.Host ~
>    "(?i)([1]|[2]|[3]$
>    ") {}
>    Can I do this only with one regular expression of the type
>    (admin\.(.*)) ?

Something like the following will match anything prefix'd with `admin`.
You'd have to include the suffixes manually.  Luckily, there aren't too many
tld's for this to be a major concern.


You can capture the entire hostname by including grouping operators
around the entire regex:




This message may contain confidential or privileged information. If you are not the intended recipient, please advise us immediately and delete this message. See for further information on confidentiality and the risks of non-secure electronic communication. If you cannot access these links, please notify us by reply message and we will send the contents to you.

More information about the varnish-misc mailing list