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

WordPress Trac noreply at wordpress.org
Fri Jun 13 17:37:11 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 changes-  |     Focuses:
  requested                                      |
-------------------------------------------------+-------------------------

Comment (by wojtekn):

 > The problem is that I don't know exactly what problems I should be
 experiencing.

 @SirLouen as far as I see, you confirmed the problem - when you requested
 such a configured site using http://localhost:8889 without the patch, you
 were incorrectly redirected to http://localhost/. With the patch, you were
 redirected to the correct canonical URL http://2854-80-102-99-22.ngrok-
 free.app/.

 That case was more visible in Studio/Local, as those local dev environment
 apps serve the site under the http://localhost:8889 URL and have the UX
 that allows opening the site using that URL.

 When using Ngrok with such a site, it's required to configure the Ngrok
 URL as the canonical URL, as in other cases, all links are pointing to
 http://localhost:8889.

 Then, when the user clicks 'Open site' in the Studio or Local:
 1. Local dev env app opens the http://localhost:8889 in the browser
 2. WordPress processes redirect to canonical URL
 3. With bug in place, user ends up at http://localhost
 4. With fix in place, user ends up at correct Ngrok URL

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


More information about the wp-trac mailing list