[wp-trac] [WordPress Trac] #34800: Wordpress canonical 301 redirects go to request origin instead of site_url
WordPress Trac
noreply at wordpress.org
Fri Nov 27 11:48:54 UTC 2015
#34800: Wordpress canonical 301 redirects go to request origin instead of site_url
--------------------------+-----------------------------
Reporter: sevcsik | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Canonical | Version: 4.3.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
I have a problem with canonical redirect using a CDN setup.
Let's say we have an origin server at `origin.example.com`, and the CDN at
`www.example.com`.
When I request `https://www.example.com/page-x`, it redirects me to
`https://origin.example.com/page-x/` instead of
`https://www.example.com/page-x/`, altough both `site_url` and `home_url`
are set to `https://www.example.com`.
I suspect that Wordpress doesn't use `site_url` when composing the
redirect URL, it's just using the request URL with a trailing slash added
(which is in fact `https://origin.example.com/page-x` as the CDN
translates the request).
The expected behaviour would be to either:
* use the correct absolute URL in the header, like `Location: <site_url>
+ <canonical_path>`
* use a relative URL, like `Location: <canonical_path>`
I also checked the Redirection plugin, which returns relative URLs in the
301 redirects, and those work fine with my setup.
Thanks for looking into this!
Sevcsik
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34800>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list