Varnish URL rewrite having integers with scientific nos in URL

kevin fernandes linuxbsdfreak at gmail.com
Wed May 8 16:05:28 CEST 2013


Hi All,

I would like to know how can i rewrite/convert a URL containing number is
scientific form to normal integer.

For eg:

I have something like this coming in the URL

http://domain.com/public/domain/app/1.024e+06/1028422/1028422_b24db5c8391ec5c5d93cd0ac083acbdf

I would like to have to have the URL having a normal integer so the output
should be

http://domain.com/public/domain/app/1024000/1028422/1028422_b24db5c8391ec5c5d93cd0ac083acbdf

Playing around something like this for testing

    if (req.http.Host ~ "domain.com") {
        set req.url = regsub(req.url,
"^/public/domain/app/[+|-]?\d\.?\d{0,}[E|e|X|x](10)?[\^\*]?[+|-]?\d+/(.*)/(.*)$",
"/public/domain/app/\d+/(.*)/(.*)$");
    }


Any ideas or any clues if the syntax for the matching scientific nos is
correct?

Regards,
Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20130508/83ec5803/attachment.html>


More information about the varnish-misc mailing list