CDN rewriting doesn't work when WP_HOME/WP_SITE_URL scheme is different than the site's URLs #2520
Closed
4 tasks done
Labels
effort: [S]
1-2 days of estimated development time
module: CDN
priority: high
Issues which should be resolved as quickly as possible
type: bug
Indicates an unexpected problem or unintended behavior
Milestone
When the
WP_HOME
is usinghttp
but the site's URLs are usinghttps
, e.g. there is an htaccess redirect fromhttp
tohttps
CDN rewriting doesn't take place.This is because of the
str_replace()
in therewrite_url
method of theCDN
class:wp-rocket/inc/classes/CDN/CDN.php
Line 120 in 00cf7a1
Example:
http://sandbox.onlinephpfunctions.com/code/1521df9f18dd8b11edf02e77f9994656078f6539
To Reproduce
Steps to reproduce the behavior:
WP_HOME
andWP_SITE_URL
are usinghttp
.http
tohttps
redirection in the.htaccess
file.Expected behavior
Static assets should be pointing to the CDN.
Additional context
Using the
rocket_is_ssl_website()
function before thestring_replace()
resolves the issue:Related ticket:
https://secure.helpscout.net/conversation/1116358022/153068/
Backlog Grooming (for WP Media dev team use only)
The text was updated successfully, but these errors were encountered: