On 09/30/2014 01:40 AM, Andreas Plesner Jacobsen wrote:
On Mon, Sep 29, 2014 at 11:46:48PM -0500, Brice Burgess wrote:

I would like to lowercase both the host and url during my
normalization routines in vcl_recv. Stackoverflow has an example
using embedded C;
[...]

Is this the recommended approach
No. Use the tolower method in the std vmod. man vmod_std


Thanks Andreas. Much preferred!  I'm now doing something like this;

normalization.vcl
====

vcl 4.0;

import std;

sub vcl_recv {

  # normalize Host header
  set req.http.Host = std.tolower(regsub(req.http.Host, ":[0-9]+", ""));


  # URL MANIPULATIONS
  ###################

  # lowercase request URL
  set req.url = std.tolower(req.url);

  ....

}

Appears to be working well!

~ Brice



_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to