Author: | Dridi Boukelmoune |
---|---|
Date: | 2012-06-18 |
Version: | 1.0 |
Manual section: | 3 |
import querystring;
Varnish multi-purpose vmod for URI query-string manipulation. Can be used to normalize for instance request URLs or Location response headers in various ways. It is recommended to at least clean incoming request URLs (removing empty query-strings), all other functions do the cleaning.
- Prototype
- ::
- clean(STRING URI)
- Return value
- STRING
- Description
- Returns The given URI with its query-string removed if empty
- Example
- ::
- set req.url = querystring.clean(req.url);
- Prototype
- ::
- remove(STRING URI)
- Return value
- STRING
- Description
- Returns The given URI with its query-string removed
- Example
- ::
- set req.url = querystring.remove(req.url);
- Prototype
- ::
- sort(STRING URI)
- Return value
- STRING
- Description
- Returns The given URI with its query-string sorted
- Example
- ::
- set req.url = querystring.sort(req.url);
In your VCL you could then use this vmod along the following lines:
import querystring; sub vcl_hash { # sort the URL before the request hashing set req.url = querystring.sort(req.url); }
This document is licensed under the same license as the libvmod-querystring project. See LICENSE for details.
- Copyright (c) 2012 Dridi Boukelmoune
querysort(3)