1

I have a problem with Wordpress and running it behind a reverse proxy. I have localized the problem and it was the solution to the question posed here: Modifying headers with IIS7 Application Request Routing

Before I applied the command in the accepted solution above, I was unable to visit any links on the website and got a too many redirects error. Turning on the option to preserve the original host header fixed those issues. But immediately after I was no longer able to edit individual pages, it would not load and return a ERR_CONNECTION_RESET error.

Since this happened right after I applied the command above I tested by turning it off again and now it works again. And predictably the other errors returned as well. So I am at an impasse here. Anyone know why the connection suddenly resets with this option turned on?

The URL that resets looks like this: http://www.siteurl.com/wp-admin/post.php?post=19&action=edit

This is the web.config for the reverse proxy site:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://192.168.111.15:8080/{R:1}" />
                    <serverVariables>
                        <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="[HTTP_ACCEPT_ENCODING]" />
                        <set name="HTTP_ACCEPT_ENCODING" value="eee" />
                    </serverVariables>
                </rule>
            </rules>

            <outboundRules>
                <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml2">
                    <match filterByTags="A, Form, Img" pattern="^http(s)?://192.168.111.15:8080/(.*)" />
                    <action type="Rewrite" value="http{R:1}://www.siteurl.com/{R:2}" />
                </rule>
                <preConditions>
                    <preCondition name="ResponseIsHtml2">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                        <add input="{HTTP_HOST}" pattern="siteurl.com" />
                    </preCondition>
                </preConditions>
            </outboundRules>
        </rewrite>
    </system.webServer>
</configuration>
Nic3500
  • 8,144
  • 10
  • 29
  • 40
Dennis
  • 373
  • 1
  • 6
  • 21
  • Tried to narrow it down further and it seems to be AJAX related. But I am no wiser for that. – Dennis Jan 15 '19 at 11:18
  • I've reinstalled worpress with a new database and now it seems to work. So it seems to be a wordpress issue and not an IIS or windows issue. edit: Spoke too soon, some things are not working anyway. – Dennis Jan 15 '19 at 13:56

1 Answers1

2

I just solved the problem! The answer was found here: https://forums.iis.net/t/1210664.aspx

I raised the response buffer threshold (in Application Request Routing -> Server Proxy Settings) by a lot and the pages I had issues with started working at once. So it was an IIS related issue.

I hope this helps someone else as it has been a couple of hair pulling days for me!

Dennis
  • 373
  • 1
  • 6
  • 21
  • I connect titana.ir/academy (IIS Server), to academy.titana.ir (Apache) with reverse proxy, but routing in WordPress does not work properly, could you lend me a hand? – msn.secret Feb 07 '23 at 06:59
  • I am not sure? Is your problem the same as mine? Did you then increase the respone buffer threshold? Perhaps creating a question with more details? – Dennis Feb 08 '23 at 06:59