[wp-trac] [WordPress Trac] #33821: redirect_canonical does not consider port in $compare_original

WordPress Trac noreply at wordpress.org
Fri Sep 11 06:32:47 UTC 2015


#33821: redirect_canonical does not consider port in $compare_original
----------------------------------------+-----------------------------
 Reporter:  willshouse                  |       Owner:
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  Future Release
Component:  Canonical                   |     Version:  2.3
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:
----------------------------------------+-----------------------------
Changes (by johnbillion):

 * keywords:   => has-patch needs-unit-tests
 * version:  4.3 => 2.3
 * component:  General => Canonical
 * milestone:  Awaiting Review => Future Release


Old description:

> In the `wp-includes/canonical.php` file the $requested_url is built
> starting at line 64. It combines is_ssl() for protocol,
> $_SERVER['HTTP_HOST'], and $_SERVER['REQUEST_URI'] - but it does not
> consider $_SERVER['SERVER_PORT']
>
> This causes a redirect loop for us because we run HTTPS on port 8443.
>
> I suggest checking to see if a port other than 80 or 443 is being used
> and adding that as part of the comparison - suggested patch attached.

New description:

 In the `wp-includes/canonical.php` file the `$requested_url` is built
 starting at line 64. It combines `is_ssl()` for protocol,
 `$_SERVER['HTTP_HOST']`, and `$_SERVER['REQUEST_URI']` - but it does not
 consider `$_SERVER['SERVER_PORT']`

 This causes a redirect loop for us because we run HTTPS on port 8443.

 I suggest checking to see if a port other than 80 or 443 is being used and
 adding that as part of the comparison - suggested patch attached.

--

Comment:

 Thanks for the patch, willshouse.

 This will need some unit tests.

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


More information about the wp-trac mailing list