Make WordPress Core

Opened 2 years ago

Last modified 2 years 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 2 years ago.

Download all attachments as: .zip

Change History (2)

#1 @ayeshrajans
2 years 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.