Under normal circumstances, Fastly would consider these URLs different objects that are cached separately:
- http://example.com
- http://example.com?asdf=asdf
- http://example.com?asdf=zxcv
It is possible, however, to have them all ignore the query string and return the same cached file.
- Log in to the Fastly web interface and click the Configure link.
- From the service menu, select the appropriate service.
- Click the Edit configuration button and then select Clone active. The Domains page appears.
- Click the Content link. The Content page appears.
-
Click the Create header button. The Create a header window appears.
- Fill out the Create a header fields as follows:
- In the Name field, type a description for the header (e.g.,
New query string name
). - 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 Name field, type a description for the header (e.g.,
- Click the Create button to create the new header. The new header you created appears on the Content page.
- 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 guide on configuring caching.