[wp-trac] [WordPress Trac] #39846: Protocol agnostic links like //foo.com produce login loop reporting cookies disabled

WordPress Trac noreply at wordpress.org
Sat Feb 11 17:16:20 UTC 2017


#39846: Protocol agnostic links like //foo.com produce login loop reporting cookies
disabled
----------------------------+------------------------------
 Reporter:  dfavor          |       Owner:
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  4.7.2
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:
----------------------------+------------------------------

Comment (by pothi):

 I use the following code (or similar) in `wp-config.php` file to let a
 site to be served on both HTTP and HTTPS, depending on the request...

 {{{
 if (isset($_SERVER['HTTPS']) &&
     ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ||
     isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
     $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
   $wplt_protocol = 'https://';
 }
 else {
   $wplt_protocol = 'http://';
 }

 $wplt_domain = 'example.com';

 define('WP_HOME', $wplt_protocol . $wplt_domain);
 define('WP_SITEURL', $wplt_protocol . $wplt_domain);
 }}}

 Since the codex recommends to [https://codex.wordpress.org/Editing_wp-
 config.php#WP_SITEURL use a protocol] for WP_SITEURL and WP_HOME, it can
 not be considered as a bug, IMO.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39846#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list