[wp-trac] [WordPress Trac] #33821: redirect_canonical does not consider port in $compare_original
WordPress Trac
noreply at wordpress.org
Tue Jul 1 06:40:06 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 has-test-info has-unit- | Focuses:
tests |
-------------------------------------------------+-------------------------
Changes (by nikunj8866):
* keywords: has-patch has-test-info has-unit-tests needs-testing => has-
patch has-test-info has-unit-tests
Comment:
== Test Report
Patch tested: https://github.com/WordPress/wordpress-develop/pull/8977
=== Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.28
- Server: nginx/1.27.5
- Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
- Browser: Chrome 138.0.0.0
- OS: Windows 10/11
- Theme: Twenty Twenty-Five 1.2
- MU Plugins: None activated
- Plugins:
* Test Reports 1.2.0
* WP Mail Logging 1.14.0
== Steps to Reproduce or Test ==
=== Test Setup(1st and 2nd Test) ===
1. In Docker Desktop, start `wordpress-develop` project.
2. Setup [https://theboroer.github.io/localtunnel-www Localtunnel] by `npm
install -g localtunnel`.
=== First Test ===
1. run `lt --port 8889`. It gives me https://two-crews-kick.loca.lt.
2. Added this URL in `wp-config.php` of `wordpress-develop`.
{{{#!php
define( 'WP_HOME', 'http://two-crews-kick.loca.lt' );
define( 'WP_SITEURL', 'http://two-crews-kick.loca.lt' );
}}}
3. Go to http://localhost:8889
4. 🐞 Redirected to http://localhost and the connection fails
(https://prnt.sc/QTEJiqATwfRr)
=== Second Test ===
1. Changed the HOME_URL and SITE_URL in `wp-config.php` to
{{{#!php
define( 'WP_HOME', 'https://two-crews-kick.loca.lt' );
define( 'WP_SITEURL', 'https://two-crews-kick.loca.lt' );
}}}
2. Go to http://localhost:8889
3. 🐞 Redirected to http://localhost and the connection fails
(https://prnt.sc/QTEJiqATwfRr)
=== Third Test ===
1. Install ngrok by `choco install ngrok`.
2. Sign up for the [https://dashboard.ngrok.com/ ngrok].
3. Added ngrok token in my system `ngrok config add-authtoken YOUR_TOKEN`
4. Applied patch https://github.com/WordPress/wordpress-develop/pull/8787
5. Added `LOCAL_HTTPS_PORT=8890` in `.env` file.
6. run 'ngrok http https://localhost:8890'. Gets https://7640-2405-201
-202e-b0f6-d19e-3557-142e-3caf.ngrok-free.app url.
7. Added this URL in `wp-config.php` of `wordpress-develop`.
{{{#!php
define( 'WP_HOME', 'https://7640-2405-201-202e-b0f6-d19e-3557-142e-3caf
.ngrok-free.app' );
define( 'WP_SITEURL', 'https://7640-2405-201-202e-b0f6-d19e-3557-142e-3caf
.ngrok-free.app' );
}}}
8. Go to http://localhost:8889
3. 🐞 Redirected to http://localhost and the connection fails
(https://prnt.sc/QTEJiqATwfRr)
=== Expected Results
When testing a patch to validate it works as expected:
- ✅ It's running as expected, like
https://core.trac.wordpress.org/ticket/33821#comment:44 comment. It's
redirected to set HOME_URL and SITE_URL instead of http://localhost.
When reproducing a bug:
- ❌ Error condition occurs.
=== Screenshots ===
**Before Patch Screencast:**
https://screenrec.com/share/wAIuiJZ0jO
**After Patch Screencast:**
https://screenrec.com/share/k1G5qXz9o8
https://screenrec.com/share/3SfbCQOgDe
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33821#comment:57>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list