• 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: $requested_url .= $_SERVER['HTTP_HOST'];.
    Instead of the value in $_SERVER['HTTP_HOST'], the value in $_SERVER['HTTP_X_FORWARDED_HOST'] should be used.
    So to fix the problem I added the following line in my wp-config.php
    if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) $_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
    I wonder if that could be definitively fixed changing line 69 of wp-includes/canonical.php with $requested_url .= isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST'];.

    • This topic was modified 1 year, 12 months ago by kappe72.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Static home page redirect error using post name premalinks behind reverse proxy’ is closed to new replies.