Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291765

Invalid JSON:API responses when maintenance mode is on

$
0
0

Problem/Motivation

The issue is fairly straight forward...

Whenever people need to update D8 instructions are the following:
https://www.drupal.org/docs/8/update/update-core-via-composer

... Stuff
Site into maintenance.
... Stuff
Site out of maintenance.

In decoupled context there is no correct way to handle the event -

site is in maintenance mode

.
So there will be public clients hitting the website, as well as jsonapi endpoints fetching data.

The issue with the maintenance mode is easily reproducible:
1. Have public read access against jsonapi endpoints.
2. Enable site maintenance mode.
3. You get a non-valid jsonapi response and broken clients. Note that from the headers of the response clients can not distinguish that it's a maintenance mode response or some reverse proxy interrupted the request.

This is preventing safe deploys on systems running jsonapi or other modules used in decoupled context. In production environment when the system is a fully decoupled one, once the site is in maintenance mode - all public clients are down.

Proposed resolution

I know this is based on middle-ware, so either:
1. JSON:API should add it's own maintenance mode middle-ware before the core's existing one.
2. Tweak / extend the maintenance mode that core already has.

I suggest to go with option 2.
The aim is to keep existing behavior as is and just add new functionality on top.
My idea proposed in #8-11 and has a PoC implemented in #12.

Remaining tasks

Direction, patch, etc...

User interface changes

None.

API changes

Api addition - new response header (implemented in #12).

Data model changes

None.

Release notes snippet

Describe the new header.


Viewing all articles
Browse latest Browse all 291765

Trending Articles