<?php
/**
* KH Speed Engine — preload overrides for Docker/Traefik hosting.
*
* Add through Code Snippets (Run everywhere) or a child theme functions.php.
* Do not add to the KH Speed Engine plugin; updates would remove it.
*/
add_action( 'init', function () {
$allowed_hosts = array( 'new.mptc.cloud', 'www.new.mptc.cloud' );
$current_host = strtolower( (string) wp_parse_url( home_url( '/' ), PHP_URL_HOST ) );
// Only apply on this site; other sites are untouched.
if ( ! in_array( $current_host, $allowed_hosts, true ) ) {
return;
}
// Docker/Traefik routes the public hostname to a private IP.
// Do not block a PHP-FPM worker waiting on a request back to itself.
add_filter( 'khse_preload_treat_private_as_local', '__return_true' );
add_filter( 'khse_preload_blocking', '__return_false' );
// The internal Traefik certificate is self-signed.
// Remove this line if the origin certificate becomes publicly trusted.
add_filter( 'khse_preload_should_verify_ssl', '__return_false' );
}, 1 );