Is it possible to manage Cache-Control headers in IIS for different static file types?

In IIS, can I configure it to return different cache headers for different static file types to the same folder?

I know that I can use the HTTP Headers function to install Expires Immediately, but this seems to affect all the content. Is there a way to do this for specific file extensions for static content?

+4
source share
1 answer

Although this is not an ideal answer, I have found a workaround. In my application, I control where my JS, CSS and other similar files are in the directory structure. What I did was put it web.configin the IIS root directory with the following lines (among other things, not related):

<configuration>
  <system.webServer>
     <staticContent>
       <clientCache cacheControlMode="DisableCache" setEtag="true" />
     </staticContent>
  </system.webServer>
</configuration>

IIS , . , HTML- (index.html) (SPA), .

, JS, CSS .. web.config :

<configuration>
  <system.webServer>
     <staticContent>
       <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="14.00:00:00" setEtag="true" />
     </staticContent>
  </system.webServer>
</configuration>

, , , . 14 , , , , , .

, HTML SPA , JS/CSS/ , . , - JS CSS, . , HTML , JS . , , HTML , .

IIS . , .

+1

All Articles