Wordpress 混合内容请求不安全的 XMLHttpRequest 端点
Wordpress Mixed content requested an insecure XMLHttpRequest endpoint
好的,我检查了所有其他类似的答案,但感谢那些无缘无故投反对票的人,没有实际的回应。
我正在使用 Wordpress,我有一个网站的混合内容 https://oujdaportail.net/
它正在生成此错误:
Mixed Content: The page at 'https://oujdaportail.net/' was loaded over
HTTPS, but requested an insecure XMLHttpRequest endpoint
'http://oujdaportail.net/'. This request has been blocked; the content
must be served over HTTPS.
Chrome调试控制台已经完全没用了!!它在没有任何可查找的源代码的第一行检测到错误。
我不确定应该如何解决这个问题...我需要帮助来找出这个问题的根源。
终于!我会成为某人的英雄...
经过数小时的斗争,结果是 wp_head
和 wp_footer
负责生成未知的 HTTP 请求。要修复它,我所要做的就是创建一个自定义 wp_head 和 wp_footer 函数,就像这样:
/**
* Wrapper for wp_head() which manages SSL
*
* @uses wp_head()
* @param bool $ssl
* @return void
*/
function custom_wp_head() {
// Capture wp_head output with buffering
ob_start();
wp_head();
$wp_head = ob_get_contents();
ob_end_clean();
// Replace plain protocols
$wp_head = preg_replace( '/(["\'])http:\/\//', 'https://', $wp_head );
// Output
echo $wp_head;
}
function custom_wp_footer() {
// Capture wp_head output with buffering
ob_start();
wp_footer();
$wp_footer = ob_get_contents();
ob_end_clean();
// Replace plain protocols
$wp_footer = preg_replace( '/(["\'])http:\/\//', 'https://', $wp_footer );
// Output
echo $wp_footer;
}
好的,我检查了所有其他类似的答案,但感谢那些无缘无故投反对票的人,没有实际的回应。
我正在使用 Wordpress,我有一个网站的混合内容 https://oujdaportail.net/
它正在生成此错误:
Mixed Content: The page at 'https://oujdaportail.net/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://oujdaportail.net/'. This request has been blocked; the content must be served over HTTPS.
Chrome调试控制台已经完全没用了!!它在没有任何可查找的源代码的第一行检测到错误。
我不确定应该如何解决这个问题...我需要帮助来找出这个问题的根源。
终于!我会成为某人的英雄...
经过数小时的斗争,结果是 wp_head
和 wp_footer
负责生成未知的 HTTP 请求。要修复它,我所要做的就是创建一个自定义 wp_head 和 wp_footer 函数,就像这样:
/**
* Wrapper for wp_head() which manages SSL
*
* @uses wp_head()
* @param bool $ssl
* @return void
*/
function custom_wp_head() {
// Capture wp_head output with buffering
ob_start();
wp_head();
$wp_head = ob_get_contents();
ob_end_clean();
// Replace plain protocols
$wp_head = preg_replace( '/(["\'])http:\/\//', 'https://', $wp_head );
// Output
echo $wp_head;
}
function custom_wp_footer() {
// Capture wp_head output with buffering
ob_start();
wp_footer();
$wp_footer = ob_get_contents();
ob_end_clean();
// Replace plain protocols
$wp_footer = preg_replace( '/(["\'])http:\/\//', 'https://', $wp_footer );
// Output
echo $wp_footer;
}