From 448e56f8141fdef18ec7aa6877d8e9acc907ba91 Mon Sep 17 00:00:00 2001 From: Joshua Terra Date: Wed, 27 May 2026 11:07:26 +0200 Subject: [PATCH] Detect AJAX requests via X-AJAX-HANDLER header (OctoberCMS 4.1) --- CHANGELOG.md | 5 +++++ classes/MaintenanceResponder.php | 7 ++++++- updates/version.yaml | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f7033f..41466f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.3.1] - 2026-05-27 + +### Fixed +- Detect AJAX requests in maintenance mode via the `X-AJAX-HANDLER` header (introduced in OctoberCMS 4.1) in addition to the legacy `X-OCTOBER-REQUEST-HANDLER` header. + ## [2.3.0] - 2025-07-03 ### Added diff --git a/classes/MaintenanceResponder.php b/classes/MaintenanceResponder.php index 34f7e4f..add018d 100644 --- a/classes/MaintenanceResponder.php +++ b/classes/MaintenanceResponder.php @@ -39,7 +39,12 @@ public function __construct( public function getResponse(): Response { if ($this->request->ajax()) { - if ($this->request->hasHeader('X-OCTOBER-REQUEST-HANDLER')) { + // X-AJAX-HANDLER: OctoberCMS 4.1+ (Larajax). + // X-OCTOBER-REQUEST-HANDLER: OctoberCMS <= 4.0 (legacy, kept for backwards compatibility). + if ( + $this->request->hasHeader('X-AJAX-HANDLER') + || $this->request->hasHeader('X-OCTOBER-REQUEST-HANDLER') + ) { return $this->responseFactory->make( $this->translator->trans('vdlp.maintenance::lang.responses.ajax.message'), config('vdlp_maintenance.http_status_code_ajax', self::HTTP_STATUS_CODE) diff --git a/updates/version.yaml b/updates/version.yaml index 8205d2f..b9e1106 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -10,3 +10,4 @@ v2.1.2: "Add .gitattributes file to plugin repository" v2.2.0: "Maintenance release (see CHANGELOG.md)" v2.2.1: "Maintenance release (see CHANGELOG.md)" v2.3.0: "Add statuscode configuration & support for October CMS 4 -- See CHANGELOG.md for details." +v2.3.1: "Detect AJAX requests via X-AJAX-HANDLER header (OctoberCMS 4.1) -- See CHANGELOG.md for details."