[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 14:07:29 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        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 In a WP site behind a reverse proxy all was working ok.
 I then set a static home page and all was still working.
 After I set post name permalinks, all pages kept working except home page,
 which had redirect errors.
 After some time spent researching the problem, I found that the problem
 was on line 69 of wp-includes/canonical.php: {{{#!php
 <?php
 $requested_url .= $_SERVER['HTTP_HOST'];
 }}}
 Instead of the value in $_SERVER['HTTP_HOST'], the value in
 $_SERVER['HTTP_X_FORWARDED_HOST'] should be used.
 I wonder if that could be definitively fixed changing line 69 of wp-
 includes/canonical.php with {{{#!php
 <?php
 $requested_url .= isset($_SERVER['HTTP_X_FORWARDED_HOST']) ?
 $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST'];
 }}}

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


More information about the wp-trac mailing list