Temporarily disabling caching

      Last updated August 09, 2018

    Caching can be disabled:

    Disabling caching at the individual URL level

    To disable caching at the individual URL level:

    1. Create a request setting that always forces a pass.
    2. Add a condition to the request setting that looks for specific URLs.
    3. Activate the new version of your service to enable the setting.

    Disabling caching at the browser level

    Theoretically, all browsers should follow the stated rules of the HTTP standard. In practice, however, some browsers don't strictly follow these rules. The following combination of headers seems to force absolutely no caching with every browser we've tested.

    Cache-Control: no-cache, no-store, private, must-revalidate, max-age=0, max-stale=0, post-check=0, pre-check=0
    Pragma: no-cache
    Expires: 0

    In addition, IE8 has some odd behavior to do with the back button. Adding Vary: * to the headers seems to fix the problem.

    Disabling caching at the site level

    You can disable caching at the site level by creating a VCL Snippet to pass on all requests to your service:

    1. Log in to 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 Domains page appears.
    4. Click the VCL Snippets link. The VCL Snippets page appears.
    5. Click Create Snippet. The Create a VCL snippet page appears.

      vcl snippet window

    6. In the Name field, type an appropriate name (e.g., Pass All Requests).
    7. From the Type controls, select within subroutine.
    8. From the Select subroutine menu, select recv (vcl_recv).
    9. In the VCL field, add the following condition:

    10. Click Create to create the snippet.
    11. Click the Activate button to deploy your configuration changes.

    All requests will continue to be passed until you remove return(pass); from vcl_recv in your VCL or you delete this snippet.

    Back to Top