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

WordPress Trac noreply at wordpress.org
Thu Jun 12 21:46:27 UTC 2025


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

Comment (by willshouse):

 I suppose this occurs so seldom that we just choose not to fix it. After
 all, @siliconforks what mentions about the HTTP specification and how it
 "should" always include a non-standard port number is true. RFC 7230,
 Section 5.4 "Host" and from Section 2.7.1 "http URI"

 I found some caveats when looking into this-

 - Some misconfigured clients, proxies, or old browsers may omit the port
 even when it's non-standard
 - PHP's $_SERVER[SERVER_PORT] gives you the actual port the server is
 listening on, regardless of the Host header

 Seems exactly like what's happening. My patch was for fixing these edge
 cases using the SERVER_PORT parameter.

 But maybe since the request is not technically up to specifications we
 mark this issue as "wontfix" per @azharderaiya

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


More information about the wp-trac mailing list