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

WordPress Trac noreply at wordpress.org
Sat Jun 14 11:19:10 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 SirLouen):

 Replying to [comment:33 wojtekn]:
 > @SirLouen maybe the browser cache? In my case, I need to open a URL in a
 browser tab with Dev Tools open, and "Disable cache" in the Network tab
 checked. In other cases, browser caches redirect most of the time.

 I commented you that I could access via mobile for a reason: there is no
 cache involved in this
 Check this video
 https://f003.backblazeb2.com/file/wordpress-videos/wp-
 videos/2025/06/33821.mp4

 As you can see, I'm browsing with a Private Firefox tab (I don't even use
 Firefox regularly)
 Here you can see that I can access the site without redirects
 But on the `curl` there is a clear Redirect with the wrong location

 We might need to understand a little better what's going on, before
 proceeding. I'm going to put again precisely my testing instructions, in
 case you want to reproduce. I also provide some env vars, like ngrok
 version and so, just for a reference.

 == Environment
 - WordPress: 6.9-alpha-60093-src
 - ngrok: 3.22.1
 - curl: 8.9.1
 - PHP: 8.2.28
 - Server: nginx/1.27.5
 - Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
 - Browser: Firefox 139.0
 - OS: Windows 10/11
 - Theme: Twenty Twenty-Five 1.2
 - MU Plugins: None activated
 - Plugins:
   * Test Reports 1.2.0

 == Testing Instructions

 1. First get the `wordpress-develop` build
 2. Patch it with my [https://github.com/WordPress/wordpress-
 develop/pull/8787 PR 8787]
 3. In the `.env` file, set the port 8890 with `LOCAL_HTTPS_PORT=8890`
 4. Run ngrok with `ngrok http https://localhost:8890`
 5. Get the URL and set it in `wp-config.php` like:
 {{{
 define( 'WP_SITEURL', 'https://e708-80-102-99-22.ngrok-free.app' );
 define( 'WP_HOME', 'https://e708-80-102-99-22.ngrok-free.app' );
 }}}

 6. Now get to access https://e708-80-102-99-22.ngrok-free.app from
 wherever you want and see its fully working without redirets or anything
 7. Try to do the `curl -k -I https://localhost:8890` to see the Location
 `https://localhost/`

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


More information about the wp-trac mailing list