Use HTTP GET to allow caching of AJAX request

Created on 19 July 2020, over 4 years ago
Updated 5 September 2023, about 1 year ago

At the moment, alerts are fetched via AJAX over HTTP POST (to the URL /ajax/site_alert). POST requests are not cacheable typically by reverse proxies and CDNs. For high traffic sites, sending a POST request on page load (and potentially on a timer after that) is not a scalable solution.

Proposed solution

  • Switch to HTTP GET for the AJAX request
  • Allow the user to set the cache lifetime of the AJAX response, e.g. it could default to the site cache lifetime (for sites with cache tag purging), but also allow it to be reduced to say 60 seconds (for sites without cache tag purging)
Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇳🇿New Zealand wiifm Wellington, NZ

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024