diff --git a/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php index e095ab4..71653b1 100644 --- a/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php @@ -97,15 +97,16 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) { // Don't cache maintenance mode pages. \Drupal::service('page_cache_kill_switch')->trigger(); - if ($request->getRequestFormat() !== 'html') { - $response = new Response($this->getSiteMaintenanceMessage(), 503, array('Content-Type' => 'text/plain')); - $event->setResponse($response); - return; - } - if (!$this->maintenanceMode->exempt($this->account)) { // Deliver the 503 page if the site is in maintenance mode and the // logged in user is not allowed to bypass it. + // If the request format is not 'html' then show default maintenance + // mode page else show a text/plain page with maintenance message. + if ($request->getRequestFormat() !== 'html') { + $response = new Response($this->getSiteMaintenanceMessage(), 503, array('Content-Type' => 'text/plain')); + $event->setResponse($response); + return; + } drupal_maintenance_theme(); $response = $this->bareHtmlPageRenderer->renderBarePage(['#markup' => $this->getSiteMaintenanceMessage()], $this->t('Site under maintenance'), 'maintenance_page'); $response->setStatusCode(503);