Reputation: 2456
We are migrating one of our websites to Azure which was previously setup using ARR (Application Request Routing) as a caching reverse proxy. It was setup as a reverse proxy which would honor the cache headers of the site it was proxying.
I've followed this guide on using an Azure website as a reverse proxy and it all works fine except that it doesn't honor the cache headers of the site it is proxying. I tried adding some more pertinent elements to my applicationHost.xdt
, but nothing I do seems to have any effect.
Here is the relevant section from my applicationHost.xdt
:
<system.webServer>
<caching xdt:Transform="Replace" enabled="true" enableKernelCache="true" maxResponseSize="1000000"></caching>
<proxy xdt:Transform="InsertIfMissing" enabled="true" reverseRewriteHostInResponseHeaders="true" minResponseBuffer="4096" responseBufferLimit="12392">
<cache enabled="true" queryStringHandling="Accept" validationInterval="00:01:00" />
</proxy>
</system.webServer>
and here is my web.config
:
<system.webServer>
<rewrite>
<rules>
<rule name="CurrentTime" stopProcessing="true">
<match url="^times/?(.*)" />
<action type="Rewrite" url="http://example.com/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
The web.config
just routes all requests to /times
to example.com
. That part is working great. It is just ignoring the cache headers of example.com
and not caching anything which is the main use case of why we want to setup a reverse proxy.
This same configuration works just fine on a normal machine with IIS and ARR installed.
I'd really like to get this working in azure websites without having to use a web role in a cloud service. I'm hoping this is possible.
Upvotes: 4
Views: 1714
Reputation: 11
Did you try to specify the preserveHostHeader="true" flag as follows?
<proxy xdt:Transform="InsertIfMissing" enabled="true" preserveHostHeader="true" reverseRewriteHostInResponseHeaders="true" />
Upvotes: 1