Make AtoM's clipboard work with the Varnish Cache web application accelerator
|Status:||In progress||Start date:||09/26/2017|
|Assignee:||José Raddaoui Marín||% Done:|
|Target version:||Release 2.7.0|
|Google Code Legacy ID:||Tested version:|
Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy, designed for content-heavy dynamic web sites as well as heavily consumed APIs. Some AtoM sites with much content and frequent visits have incorporated Varnish for noticeable improvements in response.
Around March 2017 a Varnish site was upgraded, and it was noticed clipboard functionality was not working properly.
One of our developers doing a preliminary investigation noted
Other possible solutions suggested:
Looking into it, I think that the clipboard functionality, as-is, is incompatible with Varnish because it relies on sessions to store clipboard items. Sessions rely on cookies and any page requiring a cookie can't be cached by Varnish (there is a way to do per-user caching with Varnish, but it mostly defeats the purpose of caching as you don't get many cache hits). In order to have AtoM have clipboard functionality that'll work with reverse proxies like Varnish (which we'll need for any site with high traffic) we might need to change it so the clipboard stores items in the browser's storage (i.e. LocalStorage).
- One alternative that I think it's pretty common is to move the clipboard functionality (or any other non cacheable functionality) to XHR calls that are processed asynchronously once the page loads. If you have all the endpoints using a common namespace, e.g. "/clipboard", then you can set up a rule in Varnish to explicitly disable caching for those.
- Another possibility is to transform the partial components related to the clipboard to ESI components. Symfony 2 brings ESI by default. In Symfony 1 we could use this plugin: http://www.symfony-project.org/plugins/isicsHttpCachePlugin/0_9_1.
#2 Updated by José Raddaoui Marín 17 days ago
- Status changed from New to In progress
- Assignee set to José Raddaoui Marín
- Target version set to Release 2.7.0
- Sponsored changed from No to Yes