regex matches on url escape chars

Colin Nicholson colin.nicholson at
Fri Feb 26 18:24:53 CET 2010


I have a web service which checks URLs sent to it by our software and
looks up a categorisation for that url (product is a web filter).

The request is of the form


which is checking

I would like to rewrite the request, in this case, to be just
/checkurl/facebook%2Ecom, but I can't get the % escape codes to match

If the escape codes weren't in use, the following code works fine:

if (req.url ~ "facebook\.com") {
        set req.url = "/checkurl/";


if (req.url ~ "facebook\%2Ecom") {
        set req.url = "/checkurl/facebook%2Ecom";

does not work. I've tried escaping the %2E with a backslash, but still
nothing. It isn't practical to change our software to not use the escape
codes unfortunately.

Does anyone have any ideas?


More information about the varnish-misc mailing list