The most important feature of any CDN/Cache server/provider is to reduce loading speed by delivering the requested content to a particular user, in a closer location; instead of serving the content from the original server, at a larger distance.
This is exactly one of the main goals of Fastly, that is specially optimized to be used with Magento; however there might be certain requirements, on a certain page, in which you are forced to bring all the newest data from the original server (remote server), for ensuring only the new data is served. Unfortunately, disabling Fastly Cache/CDN is not an option, because the server speed will be downgraded; so how to serve non-cacheable data only without affecting performance?
Luckily, Magento and Fastly provide a way for bypassing Fastly cache for only specific pages. This means that Fastly will still work normally for the whole site except for the pages you decide not to cache.
The above is easily configured in
Stores->Configuration->Advanced->System->Full Page Cache
If Fastly is configured in your server you should see “Fastly CDN” after expanding “Full Page Cache”. Then on Fastly Configuration->Custom VCL Snippets, click on Create Custom Snippet and create a similar snippet as follows:
Set the Name, Type and Priority as your own discretion. The key field is the VCL, in which in this example we set it as follows:
if (req.url ~ “redeximp/import/redimport”) { return (pass);}
The above snippet means that in case the user is accessing the web path redeximp/import/redimport Fastly cache should be bypassed (skipped).
Finally, after saving, in Automatic Upload & Service Activation click on Upload VCL to Fastly for applying the changes.
And that will be all; you will have more control on how Faslty behaves in your store, providing more tools for providing a better developer/user experience.