- Issue created by @mxr576
- ππΊHungary mxr576 Hungary
As π Stop using a 5xx error code for maintenance mode Closed: works as designed did not go through a long time ago, but π Invalid JSON:API responses when maintenance mode is on Fixed get merged recently, I hope this idea is welcomed.
This would allow CDNs to differentiate planned maintenance and optimize their behaviors accordingly.
Our hosting provider uses Fastly as CDN and there is an issue that currently Drupal's maintenance page is never visible to end users because Fastly cannot differentiate scheduled maintenance from other fatal errors on a site - which case it displays its own error screen.
- π¬π§United Kingdom alexpott πͺπΊπ
How about we add an X-DRUPAL-MAINTENANCE-PAGE for this? We could do something like:
if (!$this->maintenanceMode->exempt($this->account)) { // When the account is not exempt, other subscribers handle request. $this->eventDispatcher->dispatch($event, MaintenanceModeEvents::MAINTENANCE_MODE_REQUEST); // Set a header so CDNs can determine that this 503 is caused by the // maintenance page. $event->getResponse()->headers->set('X-DRUPAL-MAINTENANCE-PAGE', 1); }
in \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::onKernelRequestMaintenance()
- π¬π§United Kingdom alexpott πͺπΊπ
The reason I feel this is better than retry-after is that it is explicit rather than implied.
- πΊπΈUnited States tedfordgif
I like the idea of having both the explicit x-drupal-maintenance-[something] and the retry-after header, the latter having a random range and no-UI min/max settings like for JSON:API. However, perhaps for BC reasons retry-after should not be added to the response until a dev adds the settings (or makes them > 0)? The behavior is then different than JSON:API, but that could be harmonized in D11.
- π«π·France O'Briat Nantes
Is a more generic header exists? This Drupal one could be considered as a (small) "leak" by security review.
It's not all about CDN, the "Retry-After" header was original a google/seo recommandation (as pointed in https://www.drupal.org/project/drupal/issues/3049048 π Invalid JSON:API responses when maintenance mode is on Fixed )