Making query strings agnostic

Under normal circumstances, Fastly would consider these URLs as different objects that are cached separately:

It is possible, however, to have them all ignore the query string and return the same cached file.

  1. Log in the Fastly application and click the configure tab (wrench icon).

    the configure tab

  2. From the Service menu, select the appropriate service and then click the blue Configure button. The main controls for your selected service appear.

  3. Click Content from the section list on the left.

  4. In the Headers area, click the New button. The New Header window appears.

    the New Header window

  5. Fill out the New Header window as follows:

    • Set the Name field to whatever you want (e.g., "Chop Off Querystring")
    • Select Request from the Type menu.
    • Select Set from the Action menu.
    • In the Destination field type url.
    • In the Source field type req.url.path
    • Select No from the Ignore If Set menu.
    • Set the Priority field to whatever priority you want.
  6. Click the Create button to create the new header. The new header you created appears in the list of headers on the Content page.

The request will be sent to the origin as a URL without the query string.

For more information about controlling caching, see our Cache Control Tutorial.

Back to Top