We are using system of hidden internal sites. For hiding path we are using HttpContext.RewritePath. There is also a system for uploading photos that generates new name, and photo has no chance to change. We want to use client cache for such photos.
Url on site, that is visible for users: /files/autoupload/1/13/wufkjqr31028.jpg.[ps].jpg
Url after HttpContext.RewritePath on server: /_sites/_shared/files/autoupload/1/13/wufkjqr31028.jpg.[ps].jpg
There is web.config in "/_sites/_shared/files" folder with client cache settings:
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
</staticContent>
</system.webServer>
If "/files/autoupload/1/13/wufkjqr31028.jpg.[ps].jpg" url is requested, this settings does no apply at all. There is no Cache-Control header in response.
If full url "/_sites/_shared/files/autoupload/1/13/wufkjqr31028.jpg.[ps].jpg" is requested and our HttpContext.RewritePath skips it, cache settings works.
But if i create "/files" folder in root with same web.config, cache settings begins to work with original "/files/autoupload/1/13/wufkjqr31028.jpg.[ps].jpg" url.
So web.config client cache settings only applies by originally requested disk path and does not apply by rewritten path.
Is there any way to fix this other than creating folders in root?