Make WordPress Core

Opened 15 months ago

Last modified 15 months ago

#57134 new defect (bug)

Custom maintenance pages are HTTP 200, not 503

Reported by: desmith's profile desmith Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.1.1
Component: Bootstrap/Load Keywords:
Focuses: Cc:

Description

If WordPress' maintenance mode is activated (with wp maintenance-mode activate, for instance) by default WordPress returns the content of that page with an HTTP 503 "Service Temporarily Unavailable" status code. This makes sense, because it's maintenance, and presumably temporary.

If you have created a wp-content/maintenance.php file, though, maintenance pages displaying that content are returned as HTTP 200 OK. This could be confusing to search engines, and generally misleading.

This is happening around line 272 of wp-includes/load.php, where if a custom maintenance page is defined we simply die() as opposed to a few lines later where we can wp_die() and use a different HTTP status.

Is it intentional to return a different status when a custom maintenance page is defined? (If not, I'll write up a patch, it should be straightforward.)

Attachments (1)

57134-suggestion.patch (429 bytes) - added by ayeshrajans 15 months ago.

Download all attachments as: .zip

Change History (2)

#1 @ayeshrajans
15 months ago

Absolutely makes sense to send the 503 headers. We probably need to send no-cache headers as well as a Retry-After header to make the custom maintenance pages on par with the standard response.

Note: See TracTickets for help on using tickets.