# Filter the query string to only include query
# parameters that are valid for your site
set req.url = querystring.filter_except(req.url,
  "query" + querystring.filtersep() +
  "page" + querystring.filtersep() +
  "foo"
);

# Sort the querystring params in alphabetical order
set req.url = querystring.sort(req.url);

# Lowercase specific query param values
set req.url = querystring.set(req.url, "query", std.tolower(subfield(req.url.qs, "query", "&")));
#set req.url = std.tolower(req.url); # (Or do this to lowercase the entire request URL)

# Remove headers that you want to avoid using to vary responses
unset req.http.user-agent;
unset req.http.cookie;

# Normalise headers that you may vary on.  Accept-Language has a dedicated normalising function
set req.http.Accept-Language = accept.language_lookup("en:de:fr:nl", "de", req.http.Accept-Language);
set req.http.Accept = accept.media_lookup(
  "image/jpeg:image/png", # Exact match candidates
  "text/plain",           # Fallback
  "image/tiff:text/html", # Pattern match candidates
  req.http.Accept         # Input
);
set req.http.Accept-Encoding = accept.encoding_lookup(
  "br:compress:deflate:gzip",
  "identity",
  if (
    req.http.Fastly-Orig-Accept-Encoding,
    req.http.Fastly-Orig-Accept-Encoding,
    req.http.Accept-Encoding
  )
);
set req.http.Accept-Charset = accept.charset_lookup(
  "iso-8859-5:iso-8859-2",
  "utf-8",
  req.http.Accept-Charset
);

# Avoid cache for the purposes of the demo
return(pass);