Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • bh 188 posts 633 karma points
    Jun 14, 2019 @ 15:26

    My higher-ups asked me to address issues we have with elements of our umbraco website caching in the browser.

    So I started with gulp-cachebust to hash the filenames of my *.css and *.js files. I'm very happy with the results there.

    Next I wanted to attack HTML caching. And this is where I'm not sure how to proceed. As you can see from my screengrab below, my homepage cache-control is set to private. I think maybe that should be set to no-cache. Also, there's no ETag header. I think adding an ETag header might help.

    Here's my relevant web.config code:

          <remove fileExtension=".air" />
          <mimeMap fileExtension=".air" mimeType="application/vnd.adobe.air-application-installer-package+zip" />
          <remove fileExtension=".svg" />
          <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
          <remove fileExtension=".woff" />
          <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
          <remove fileExtension=".woff2" />
          <mimeMap fileExtension=".woff2" mimeType="application/x-font-woff2" />
          <remove fileExtension=".less" />
          <mimeMap fileExtension=".less" mimeType="text/css" />
          <remove fileExtension=".mp4" />
          <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
          <remove fileExtension=".json" />
          <mimeMap fileExtension=".json" mimeType="application/json" />
          <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />

    Is it possible/advisable to use UseMaxAge for my static elements in the mimeMaps you see in my code, and use no-cache for my *.aspx and *.cshtml?

    enter image description here

  • bh 188 posts 633 karma points
    Jun 14, 2019 @ 15:46

    Ended up using an outbound rewrite rule to add the no-cache header to my html files while maintaining my UseMaxAge on my static content.

                <rule name="RewriteCache-Control" preCondition="IsHTML">
                    <match serverVariable="RESPONSE_Cache-Control" pattern="(.*)" />
                    <action type="Rewrite" value="no-cache" />
                    <preCondition name="IsHTML">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
Please Sign in or register to post replies

Write your reply to: