[wp-trac] [WordPress Trac] #43127: Error with Mixed Content when using https

WordPress Trac noreply at wordpress.org
Thu Jan 18 23:02:47 UTC 2018


#43127: Error with Mixed Content when using https
--------------------------+-----------------------------
 Reporter:  jeremyschiff  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.9.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hi all,

 We run a microservices architecture, where we proxy inbound requests to
 internal services.  The inbound requests are in HTTPS, but the request to
 the  wordpress server is proxied via HTTP once inside our VPN.  As a
 result, the service mis-identifies the protocol as https, and gives a
 mixed content error (we enforce all content is requested via https, so
 things like javascript and CSS were failing to load) and much of the site
 refuses to load.  Would it be possible to add a parameter that would allow
 us to force HTTPS in all links, and disable https redirect on admin?  I
 was able to do this with the following code edits, but need this merged in
 so that our solution is sustainable.

 -Jeremy

 =============================================

 I added to wp-config.php:
   define('FORCE_NO_SSL_ADMIN', TRUE);
   define('FORCE_SCHEME', 'https');

 In linkTemplate.php's method for set_url_scheme, I enabled the following
 control.

   function set_url_scheme( $url, $scheme = null ) {
   $orig_scheme = $scheme;
   if (defined('FORCE_SCHEME') && FORCE_SCHEME) {
   $scheme = FORCE_SCHEME;
   } elseif ( ! $scheme ) {
   ...
 In default-constants.php, we modify this so we don't get stuck in an
 infinite loop, as the https occurs through the proxy server

   function wp_ssl_constants() {
   if ( !defined( 'FORCE_SSL_ADMIN' ) ) {
   if (defined('FORCE_NO_SSL_ADMIN') && FORCE_NO_SSL_ADMIN) {
   define( 'FORCE_SSL_ADMIN', false );
   } elseif ( 'https' === parse_url( get_option( 'siteurl' ),
 PHP_URL_SCHEME ) ) {
   ...

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43127>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list