JQuery script getting cut off when accessed via reverse proxy

送分小仙女□ 提交于 2019-12-13 21:03:54

问题


We have a reverse proxy server running on wwwdev.example.com, and we have the full site running on dev.example.com. If I go to dev.example.com/scripts/jquery-version.js, I get the full jQuery-version.js file returned, ending like this:

if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
    define( "jquery", [], function () { return jQuery; } );
}

})( window );

If I go to wwwdev.example.com/scripts/jquery-version.js, the file is cut off before it completes:

if ( typeof define === "function" && define.amd && define.amd.jQuery ) 

The only relevant inbound rule follows:

<rule name="ReverseProxyInboundRule1" enabled="true" stopProcessing="true">
    <match url="(.*)" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{HTTP_HOST}" pattern="^(.+?\.)?wwwdev\.example\.com" />
    </conditions>
    <serverVariables>
        <set name="HTTP_ACCEPT_ENCODING" value="" />
        <set name="HTTP_X_PROXY_REQUEST" value="" />
    </serverVariables>
    <action type="Rewrite" url="http://{C:1}dev.example.com/{R:1}" logRewrittenUrl="true" />
</rule>

The only relevant outbound rule follows:

<rule name="Rewrite Links in JS" preCondition="IsJavascript" enabled="true">
    <match filterByTags="None" pattern="&quot;/(.+)&quot;" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="true" />
    <action type="Rewrite" value="&quot;http://wwwdev.example.com/{R:1}&quot;" />
</rule>
<preConditions>
    <preCondition name="IsJavascript">
        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^application/x-javascript" />
    </preCondition>
</preConditions>

Static compression is on; dynamic compression is off. I've tried turning static compression off as well, but that doesn't seem to affect this result.

When I capture with Fiddler, I can see the full file returned, but it doesn't make it through the browser (IE or Chrome). I do get a Content-Length mismatch reported through Fiddler (Response Header indicated 266,885 bytes, but server sent 266,961 bytes), which I would assume is relevant, but I'm not sure what's causing the issue.

Any ideas would be GREATLY appreciated - this has been driving me nuts.


回答1:


Answer found here:

Under the Application Request Routing Cache feature of the IIS server node, under Server Proxy Settings, Response buffer threshold (KB) needs to be set to 4096 (to match the Response buffer (KB)).



来源:https://stackoverflow.com/questions/27510497/jquery-script-getting-cut-off-when-accessed-via-reverse-proxy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!