-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
The WordPress AMP plugin generates JSON responses when performing AMP validation. LiteSpeed Cache is currently appending this HTML comment to all responses, including those which do not have a text/html content type. This is breaking the AMP plugin's ability to obtain validation results. I've had to provide users with a workaround plugin to disable the litespeed_comment filter.
This logic here:
lscache_wp/litespeed-cache/inc/litespeed-cache.class.php
Lines 556 to 558 in 6f3e5bd
| if ( $this->footer_comment ) { | |
| $buffer .= $this->footer_comment ; | |
| } |
The condition should be changed as follows:
$content_type = ini_get( 'default_mimetype' );
foreach ( headers_list() as $header ) {
list( $name, $value ) = explode( ':', $header, 2 );
if ( 'content-type' === strtolower( $name ) ) {
$content_type = trim( $value );
break;
}
}
if ( $this->footer_comment && 'text/html' === substr( $content_type, 0, 9 ) ) {Support forum topics:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels