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

WordPress Trac noreply at wordpress.org
Fri Jun 13 07:33:46 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 wojtekn):

 @SirLouen, thanks for being open to help with that issue! My bad, I
 haven't provided clear steps to reproduce earlier.

 I can't reproduce it in WordPress Studio as we fixed this issue with a mu-
 plugin. The most straightforward steps to reproduce using Local:

 1. Start Local
 2. Ensure to have 'Router mode' set to localhost (Preferences -> Advanced)
 3. Create a new site and start it
 4. Note site's host, e.g. localhost:10003
 5. Start the ngrok tunnel pointing to the site:


 {{{
 ngrok http 10003
 }}}


 6. Update `wp-config.php` and set canonical URLs:

 {{{
 define( 'WP_HOME', 'https://MY-NGROK-URL.ngrok-free.app');
 define( 'WP_SITEURL', 'https://MY-NGROK-URL.ngrok-free.app');
 }}}

 7. Open http://localhost:10003/ in a browser or test using curl:

 {{{
 curl -I http://localhost:10003
 }}}

 Expected behavior: User is redirected to `https://MY-NGROK-URL.ngrok-
 free.app`
 Current behavior: User is redirected to `http://localhost`

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


More information about the wp-trac mailing list