LOG IN SIGN UP
Documentation

Making query strings agnostic

Under normal circumstances, Fastly would consider these URLs 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 web interface and click the Configure link.
  2. From the service menu, select the appropriate service.
  3. Click the Edit configuration button and then select Clone active. The service version page appears.
  4. Click the Content tab. The Content page appears.
  5. Click the Create header button. The Create a new header window appears.

    the New Header window

  6. Fill out the Create a new header fields as follows:

    • From the Type menu, select Request, and from Action menu, select Set.
    • In the Destination field, type url.
    • In the Source field, type req.url.path.
    • From the Ignore if set menu, select No.
    • Set the Priority field to whatever priority you want.
    • In the Description field, type a description for the header (e.g., New query string name).
  7. Click the Create button to create the new header. The new header you created appears on the Content page.

  8. Click the Activate button to deploy your configuration changes.

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.


Additional resources:


Back to Top