Support » Fixing WordPress » too many redirects and missing images when behind apache reverse proxy

  • Eric



    I’ve been fighting with this issue for a couple weeks now and I’ve finally run out of patience and help posts.

    Our company just recently decided to switch to wordpress for their homepage. We had a contractor and a member of our team here sit down and create the site on an internal test server and everything looks great and is working well…. on the test server.

    We have two internal servers that host all of our apps. Both are exactly the same and in the event of an outage on one box all traffic is rerouted to the other. This works well for our current set up.

    I’ve created a new LAMP server and set up apache with the mod_proxy, mod_proxy_balancer, mod_rewrite, and a few others. I set up a cluster for both of our internal servers, and set the config as so:

    ProxyPreserveHost On
            ProxyRequests Off
            <Proxy balancer://testcluster>
                    BalancerMember http://internal1/wordpress
                    #BalancerMember http://internal2/wordpress
                    #BalancerMember http://test
                    Order allow,deny
                    Allow from all
            <Location /home>
                    ProxyPass balancer://testcluster/
                    ProxyPassReverse balancer://testcluster/
                    Order allow,deny
                    Allow from all
            #ProxyPass /home balancer://testcluster/
            #ProxyPassReverse /home balancer://testcluster/

    Now when I hit it redirects to either internal1/wordpress or internal2/wordpress. However when I loaded the page only a few images would display and none of the links work. So after some digging I found another post on here about a similar issue with images not showing when behind a reverse proxy.

    So following the post ( I set the following wp-config settings:

    define('WP_HOME', 'lampBox1/home');
    define('WP_SITEURL', 'lampBox1/home');
    $_SERVER['REQUEST_URI'] = str_replace("wordpress", "home", $_SERVER['REQUEST_URI']);

    However the images are still missing and now when clicking links they end up giving an “ERR_TOO_MANY_REDIRECTS” and a bunch of status 301 codes in the network console on chrome.

    I’m about at my wits end and can’t figure out for the life of me how to get this to work correctly. Any help would be much appreciated.

Viewing 1 replies (of 1 total)
  • Hello,

    I will say something very stupid but, why don’t you use a simple / cheap VPS for the tests? That’s what we do in general.

    (proxies will only create more headache / fake local dns management – and a good vps is 5 bucks now – if not free for a trial)

Viewing 1 replies (of 1 total)
  • The topic ‘too many redirects and missing images when behind apache reverse proxy’ is closed to new replies.