This module will make your ajax-enabled Views, use GET instead of POST.

Why?
Because GET is much better for caching. Typically, CDN's or reverse-proxies like Varnish will not store POST requests.

Views uses the Drupal Ajax framework. This by default uses POST.
While a lot of Ajax inside of Drupal requires POST (think the Views UI, for example), a view itself doesn't. If you disable Ajax on a View, it will use GET anyway.

How?
This module overrides a core Drupal Ajax JavaScript function (this is sometimes referred to as monkey-patching).
@See #956186: Allow AJAX to use GET requests which is an issue to bring this functionality into core, without the need for overriding in the way that this module does.

Note:
Drupal sends additional data in the POST request about the current page state. This includes a list of all the libraries included on the current page, as well as the current theme. Because of the size this can make the request can be too large when using GET, they are not included when using a GET request.
Currently the only known issue this causes is when using a theme that is not the site's default. See #2938055: Rendering may not use correct theme

There is also a known incompatibility with other modules that modify the views ajax url, e.g. views ajax history. See #2913388: Disable URL replacement on GET requests in Drupal.Ajax.prototype.beforeSend

Drupal 8

Setup instructions

  • Once this module is enabled, enable the Views ajax get display extender (/admin/structure/views/settings/advanced)
  • Enable on each view by editing the "Use AJAX" setting, and enabling GET.

Project information

Downloads