• We have a wordpress multi site, the main site has a URL similar to mainsite.com

    Each of the sub sites have a URL such as subdomain1.mainsite.com, subdomain2.mainsite.com etc Each of the sub sites we would like to potentially hide behind a separate reverse proxy eg revprox1.com/rp1subsite shows subdomain1.mainsite.com, revprox2.com/rp2subsite shows subdomain2.mainsite.com etc

    Doing the reverse proxy on IIS7 works using the code below and the site is displayed on the relevant reverse proxy URL, however all the hyper links on the page refer to the original URL and not the reverse proxy due to wordpress using absolute paths. We installed a plugin to force wordpress to enforce relative paths for all the links, at this point all the links worked, the reverse proxy folder was appended to the beginning of the link, however the CSS was broken as it was looking for the CSS at the root of the reverse proxy and was not appending the reverse proxy folder eg it was looking for the CSS at revprox1.com/css.css rather than revprox1.com/rp1subsite/css.css

    I was wondering if anyone has ever tried to set WordPress up like this before and what I should be looking at to combat this problem, as if the CSS was looking in the correct place it would work for us. We cant really be changing the database as we want to be able to allow our site administrators to setup new sites with minimal involvement from IT.

    <rule name="Reverse Proxy to Site 1" stopProcessing="true">
                <match url="^rp1subsite/(.*)" />
                <action type="Rewrite" url="http://subdomain1.mainsite.com/{R:1}" />
            </rule>
            <rule name="Reverse Proxy to Site 2" stopProcessing="true">
                <match url="^rp2subsite/(.*)" />
                <action type="Rewrite" url="http://subdomain2.mailsite.com/{R:1}" />
            </rule>
        </rules>
        <outboundRules>
            <rule name="Add application prefix" preCondition="IsHTML">
                <match filterByTags="A" pattern="^/(.*)" />
                <conditions>
                    <add input="{URL}" pattern="^/(rp1subsite|rp2subsite)/.*" />
                </conditions>
                <action type="Rewrite" value="/{C:1}/{R:1}" />
            </rule>
            <preConditions>
                <preCondition name="IsHTML">
                    <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                </preCondition>
            </preConditions>
        </outboundRules>

  • The topic ‘Reverse Proxies and Multisite’ is closed to new replies.