Support » Fixing WordPress » WordPress behind reverse proxy

  • Resolved arodessa

    (@arodessa)


    Hello,

    First of all I’m running the latest version of wordpress and I have read what I believe are all the posts on the support forums about this issue, but I’m unable to resolve it for myself.

    The setup:

    wordpress is installed on firewalled internal server http://some.domain.com:12345/wordpress

    public proxy server is on http://some.example.com/home

    The redirect happens as expected, however, all the images (theme layout) and css doesn’t show up to the outside world because wordpress is using the absolute path to the images (i.e. some.domain:12345) which is not accessible from outside the firewall.

    To solve this I have tried setting site/wordpress url from admin site to various values…with no success, since after the change I could no longer login to the admin side even internally — so I reverted this change.

    I have tried editing _SERVER[‘HTTP_HOST’] variable in wp-config: at best I get “http://some.example.com:12345/wordpress” when I try to access wordpress from the public proxy, which obviously doesn’t work. At least the internal url still works.

    I’ve tried going through the individual php files and modifying REMOTE_ADDR to HTTP_X_FORWARDED_HOST, that really did not help so I reverted this change. I get infinite redirect problem, which I’ve also read about. I’ve set ProxyPreserveHost on, which doesn’t seem to have had a positive effect.

    I’ve RTFM about the _SERVER variable, and tried to play with other pieces of it with no success.

    My problem might be that I’m using piecemeal knowledge to solve this issue and turning “switches” on and off blindly. A lot of the forum posts address a specific part, but there is nowhere that I’ve found that provides a global solution. (Let me know if you need more detail about any of the specific solutions I’ve tried.)

    Any help is appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • arodessa

    (@arodessa)

    In hopes other ppl find this helpful, here’s how I resolved my issue

    in wp-config.php, aside from the lines:
    $_SERVER[‘HTTP_HOST’] = $_SERVER[‘HTTP_X_FORWARDED_HOST’];
    define(‘WP_HOME’, ‘http://some.example.com/home;
    define(‘WP_SITEURL’, ‘http://some.example.com/home’);

    I also added:

    $_SERVER[‘REQUEST_URI’] = str_replace(“wordpress”, “home”,
    $_SERVER[‘REQUEST_URI’]);

    This made all the css and images show up correctly.

    Thanks arodesa!

    Thank you so much!!! This saved my day. I had been stuck trying to figure this out for hours.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress behind reverse proxy’ is closed to new replies.