IIS reverse proxy response being cut off

59 Views Asked by At

I'm a beginner at IIS configuration and I'm having some problems configuring a reverse proxy on my public IIS server to serve as a reverse proxy for a service in a docker container in another internal server.

So far it's been working fine, but I'm having some problems with the response of one specific request not being received completely when accessed over the internet but still responding with a 200 status

Over LAN it works just fine enter image description here

enter image description here

but when I go to the same page over the internet the last few characters are being cut off

enter image description here

enter image description here

I noticed the response headers were a bit different which lead me to these posts and SO answers: https://techcommunity.microsoft.com/t5/iis-support-blog/setup-iis-with-url-rewrite-as-a-reverse-proxy-for-real-world/ba-p/846222

https://techcommunity.microsoft.com/t5/iis-support-blog/iis-acting-as-reverse-proxy-where-the-problems-start/ba-p/846259#M344

https://stackoverflow.com/a/15936632/7023800

and so far my web.config rewrites looks like this:

 <rewrite>
            <rules>
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://my.internal.server:3000/{R:1}" logRewrittenUrl="true" />
                    <serverVariables>
                        <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
                        <set name="HTTP_ACCEPT_ENCODING" value="" />
                    </serverVariables>
                </rule>
            </rules>
            <outboundRules>
                <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
                    <match filterByTags="A, Form, Img" pattern="^http(s)?://my.internal.server:3000/(.*)" />
                    <action type="Rewrite" value="http{R:1}://my.external.server/{R:2}" />
                </rule>
                <rule name="RestoreAcceptEncoding" preCondition="NeedsRestoringAcceptEncoding">
                    <match serverVariable="HTTP_ACCEPT_ENCODING" pattern="^(.*)" />
                    <action type="Rewrite" value="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" />
                </rule>
                <preConditions>
                    <preCondition name="NeedsRestoringAcceptEncoding">
                        <add input="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" pattern=".+" />
                    </preCondition>
                </preConditions>
            </outboundRules>
        </rewrite>

I also tried to increase the response buffering limit in my Site from 4MB to 64MB

enter image description here

and the Response buffer threshold in my IIS reverse proxy server ARR (i increased it up to 1024 KB and still doesn't work) (ARR does not send Response.Flush content to client & IIS reverse-proxy not sending full response body)

enter image description here

But it still doesn't work as expected.
Any help would be really appreciated.
Thank you in advance.

0

There are 0 best solutions below