Setting Surrogate-Key headers based on a URL
Last updated September 20, 2016
Follow these instructions to set Surrogate-Key headers based on a URL:
- 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 service version page appears.
Click the Content tab. The Content page appears.
Click the Create header button. The Create a new header page appears.
- Fill out the Create a new header fields as follows:
- From the Type menu, select Cache, and from the Action menu, select Set.
- In the Destination field, type
- In the Source field, type
regsub(req.url, "^/(.*)\.(.*)$", "\1"). This will accept a URL that looks like
/foo.htmland will create the Surrogate-Key
- From the Ignore if set menu, select No.
- In the Priority field, type
- In the Description field, type a human-readable name for the header. This name is displayed in the Fastly web interface.
- Click the Create button to create your header.
- Click the Activate button to deploy your configuration changes.
NOTE: There are several limitations to surrogate keys. See the surrogate key limitations section for more information.
Back to Top