[wp-trac] [WordPress Trac] #57260: Static home page redirect error using post name premalinks behind reverse proxy

WordPress Trac noreply at wordpress.org
Fri Dec 2 16:42:02 UTC 2022


#57260: Static home page redirect error using post name premalinks behind reverse
proxy
--------------------------+------------------------------
 Reporter:  kappe72       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Canonical     |     Version:  6.1.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by kappe72):

 Replying to [comment:1 SergeyBiryukov]:
 > Hi there, welcome to WordPress Trac! Thanks for the report.
 >
 > This appears to be similar to #31288, #40013, #49970 and some other
 related tickets.
 >
 > This is something that comes up often, but is not something that can be
 fixed due to the nature of handling client-provided headers, which is
 what's needed to address the issue. See comment:17:ticket:31288 for more
 info.
 >
 > The long and short of it is that this is a server-level configuration
 issue with reverse proxy web servers. It's not a WordPress issue, and it's
 not limited to WordPress. There's no need to modify the
 `redirect_canonical()` function.
 >
 > You just need to add something along the lines of the following code
 fragment to your `wp-config.php` file, before the `/* That's all, stop
 editing! Happy publishing. */` comment, that way it won't be overwritten
 on updates:
 > {{{
 > if ( isset( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ) {
 >       $_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
 > }
 > }}}
 >
 > Any proxy configuration is "supported" by WordPress, you just need to
 remap the `$_SERVER['HTTP_HOST']` server variable based the particular
 proxy configuration you're using.


 Thank you,
 editing my `wp-config.php` is what I already did to solve the issue.
 I thought it was WP related, that's why I reported it.
 BTW I didn't find any documentation about remapping the
 `$_SERVER['HTTP_HOST']` when behind a reverse proxy.

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


More information about the wp-trac mailing list