LogoLogo
  • Welcome
  • Landing in Transparent Edge
  • Sign up process
  • Getting Started
    • Basics concepts
      • Glosary
        • API
        • Brotli Compression
        • Cache-Control
        • Cache key
        • Caching
        • CNAME
        • Cloud Computing
        • Cloud Computing Architecture
        • Cloud Services
        • DASH
        • Data Center
        • Edge Server
        • ETag
        • GSLB
        • HLS (HTTP Live Streaming)
        • HTTP/2
        • Infrastructure as a Service (IaaS)
        • Internet Exchange Point
        • Last-Modified
        • Load Balancing
        • MultiCDN
        • NoSQL (not only SQL)
        • Origin
        • Origin Shield
        • OTT (Over The Top)
        • Platform as a Service (PaaS)
        • PoP (Point of Presence)
        • Private CDN
        • Private Cloud
        • Public Cloud
        • Purge
        • Query String
        • Reverse Proxy
        • RTT (Round-trip Time)
        • SaaS (Software as a Service)
        • SDS (Software Defined Storage)
        • Smooth Streaming
        • Status Code
        • TCP (Transmission Control Protocol)
        • TLS Acceleration
        • TLS (Transport Layer Security)
        • TTFB (Time-to-first-byte)
        • TTL (Time-to-live)
        • Virtual Machine
        • VPS (Virtual Private Server)
        • Web Services
      • Let's start at the beginning
      • Things to consider
      • Houston, we have a problem
      • HTTP, How does it work?
      • Invalidating methods
      • DNS Pointing
      • Log formats
      • Predefined headers
      • Default headers
        • geo_country_code
        • X-Device
        • Vary
        • Cache headers
        • Age
        • TP-Cache
        • True-Client-IP and X-Forwarded-For
      • Forcing No-Cache
      • Architecture
        • Transparent Edge’s IP addresses
        • Locations and PoP
        • Cache layers
      • Cache effectiveness
      • SSL
      • HTTP 5xx Error Codes
      • Features
        • Protection against origin failures
        • Rate Limit
        • Geolocation and geoblocking
        • Prefechting
        • Refetching
        • Fast purging
        • HTTP Redirects
        • Caching static vs. dynamic objects
        • Rewriting of headers
        • Device detection
    • Dashboard
      • Historic
      • Analytics
      • Invalidating content
      • Content invalidation by tags
      • Prefetching Cache
      • Log shipping
      • Provisioning
        • Initial configuration
        • Backends
        • Sites
        • Configuration deployments
        • Network ACLs
        • TLS/SSL Certificates
      • User management
  • Configuration
    • VCL Reference
      • Default Functions
      • VCL Objects
      • Callable Functions
      • Security restrictions
      • Varnish book
    • Network Access Control List
      • Initial configuration
      • Auto generated lists
      • Manage lists via API
    • i3
      • Quality adjustment
      • Cache timing allocation for transformed images
      • Conversion to grayscale
      • Conversion to WebP
      • Blurring
      • Inclusion of graphics in the footer (strip)
      • Automatic resizing
      • Definition of the maximum size (content-length)
    • Transcoding
      • Relaunch or requeue jobs
      • Create a transcode job
      • Get job information
      • Dashboard usage
    • OpenAPI de TransparentCDN
  • Security
    • HTTPS
    • Blocking User-Agent
    • Blocking by IP Address
    • Blocking Requests Geographically
    • Avoiding Hotlinking
    • Bot Mitigation
    • WAF
      • Configuration
      • CAPTCHA
      • Content protected by token
      • Rate limit
    • Anomaly Detection
      • Detection Types
      • Automatic Reactions
      • Detection History
    • Under attack mode
    • Global Whitelists
  • Integrations
    • Wordpress plugin
    • Google Cloud Platform
    • Amazon Web Services
  • GUIDES AND TUTORIALS
    • How to do things
    • Edge Computing
      • ESI Tags
    • Acting on the Query String
    • Working with cookies
    • Making decisions based on HTTP headers
    • Web Application Gateway
    • Configure your servers to send cache headers
    • Caching a version per device
    • True-Client-IP in the origin
    • A/B Testing
    • Routing traffic to different backends
    • JSON Web Tokens
    • Debug codes
    • Streaming logs
    • API
      • Authentication
      • Invalidation
Powered by GitBook
On this page
  • Normalizing the QS
  • We remove parameters from the QS
  • Removing a parameter from the QS using regex:

Was this helpful?

Export as PDF
  1. GUIDES AND TUTORIALS

Acting on the Query String

PreviousESI TagsNextWorking with cookies

Last updated 1 year ago

Was this helpful?

At Transparent Edge, we implement , and therefore you can take advantage of all the benefits it offers.

In this case, we will discuss how to use the module in Transparent Edge to interact with the query string of a web request.

Normalizing the QS

You may want to normalize the URL, particularly its parameters. For example, the order in which they arrive may be important to increase , and you may want to ensure that the URL parameters always arrive in the same order regardless of the site from which they are called

sub vcl_recv
{
    urlplus.write();
}

In any case, if you don't want to sort it, you just need to do the following:

sub vcl_recv
{
    urlplus.write(sort_query = false);
}

You must always call the "write" method when working with the urlplus module and you want to modify the URL.

We remove parameters from the QS

Sometimes it may be necessary to remove certain parameters from the query string that arrives at Transparent CDN in order to improve cache effectiveness or simply because we want the URL to be sent to the origin without a specific parameter. One way to do this is as follows, in this case, we are removing a parameter named random:

sub vlc_recv {
    urlplus.query_delete("random");
    urlplus.write();
}

Removing a parameter from the QS using regex:

Just like the previous example, you may be interested in removing one or multiple parameters from the query string based on a regular expression. For example, we can remove all the parameters added by Google Analytics:

sub vcl_recv
{
    urlplus.query_delete_regex("utm_");
    urlplus.write();
}

Other functions that can be useful to you are:

  • query_keep. to remove all the query string except for a specific parameter.

  • query_get. to retrieve the value of a parameter from the query string.

  • tolower. to convert the entire URL to lowercase.

  • toupper. to convert the entire URL to uppercase.

  • query_add. to add a parameter to the URL.

You can find the complete documentation of this module at the following

Varnish Enterprise
urlplus
cache effectiveness
Varnish Enterprise
link.