Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi everybody,
I have a questions regarding the Leverage browser caching - where to place it in my web.config.
I found some useful information on here - gitHub however after inserting the code into my web.config the pageSpeed did not improve.
The code I have uploaded was
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
And I have uploaded to my web.config file see code below:
<system.webServer> <validation validateIntegratedModeConfiguration="false" /> <modules runAllManagedModulesForAllRequests="true"> <remove name="WebDAVModule" /> <remove name="UmbracoModule" /> <add name="UmbracoModule" type="Umbraco.Web.UmbracoModule,umbraco" /> <remove name="ScriptModule" /> <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <remove name="ClientDependencyModule" /> <add name="ClientDependencyModule" type="ClientDependency.Core.Module.ClientDependencyModule, ClientDependency.Core" /> <!-- Needed for login/membership to work on homepage (as per http://stackoverflow.com/questions/218057/httpcontext-current-session-is-null-when-routing-requests) --> <remove name="FormsAuthentication" /> <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" /> <add name="ImageProcessorModule" type="ImageProcessor.Web.HttpModules.ImageProcessingModule, ImageProcessor.Web" /> </modules> <handlers accessPolicy="Read, Write, Script, Execute"> <remove name="WebServiceHandlerFactory-Integrated" /> <remove name="ScriptHandlerFactory" /> <remove name="ScriptHandlerFactoryAppServices" /> <remove name="ScriptResource" /> <remove name="ClientDependency" /> <remove name="MiniProfiler" /> <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add verb="*" name="ClientDependency" preCondition="integratedMode" path="DependencyHandler.axd" type="ClientDependency.Core.CompositeFiles.CompositeDependencyHandler, ClientDependency.Core" /> <add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" /> <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> <remove name="OPTIONSVerbHandler" /> <remove name="TRACEVerbHandler" /> <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> </handlers> <!-- Adobe AIR mime type --> <staticContent> <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" /> <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" /> </staticContent>
Thanks for any help and merry x-mas guys.
Regards
Hi Pavol
Try to add cacheControlCustom="public" :
<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
Also, it looks like google can do not make test again if you try to test the same url in a short period of time
Thanks,
Alex
Please post the error from Google Insights. I recently had quite a battle with Insights, so I might be able to help. I too added the "clientCache" code to my web.config along the way, but that was specifically for caching .svg files.
How did you get it to cache the SVGs? I need to do the same thing.
Add this to the <staticContent> section of the web.config did it for me (like OP did):
<staticContent>
Thanks Ole I was missing the cacheControlCustom attribute, but it still hasn't helped me.
https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fwww.codeshare.co.uk&tab=desktop
I see no issues related to .svg files?
Good point. It has fixed that issue now. Thanks. Still got the issue with the other ones though.
I'm pretty sure it's related to the ImageProcessor, try look at this:
With ImageProcessor, error is present: https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fwww.codeshare.co.uk%2Fmedia%2F1319%2Fhqdefault-3.jpg%3Fquality%3D30%26format%3Dpng8
Without ImageProcessor, error is gone: https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fwww.codeshare.co.uk%2Fmedia%2F1319%2Fhqdefault-3.jpg
Do you need to convert the images from jpg to png8? If not, try to remove that parameter from the image url.
I haven't experienced this myself, but I did struggle with Google wanting me to compress the images more. If you didn't already, you should add this: https://www.nuget.org/packages/ImageProcessor.Web.PostProcessor/
In
<staticContent> <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/font-woff" /> <remove fileExtension=".woff2" /> <mimeMap fileExtension=".woff2" mimeType="font/woff2" /> <remove fileExtension=".eot" /> <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" /> <remove fileExtension=".ttf" /> <mimeMap fileExtension=".ttf" mimeType="application/font-sfnt" /> <remove fileExtension=".otf" /> <mimeMap fileExtension=".otf" mimeType=" application/font-sfnt" /> <remove fileExtension=".less" /> <mimeMap fileExtension=".less" mimeType="text/css" /> <remove fileExtension=".webp" /> <mimeMap fileExtension=".webp" mimeType="image/webp" /> <remove fileExtension=".mp4" /> <mimeMap fileExtension=".mp4" mimeType="video/mp4" /> <remove fileExtension=".webm" /> <mimeMap fileExtension=".webm" mimeType="video/webm" /> <remove fileExtension=".ogv" /> <mimeMap fileExtension=".ogv" mimeType="video/ogg" /> <remove fileExtension=".json" /> <mimeMap fileExtension=".json" mimeType="application/json" /> <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="8.00:00:00" /> </staticContent>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Leverage browser caching
Hi everybody,
I have a questions regarding the Leverage browser caching - where to place it in my web.config.
I found some useful information on here - gitHub however after inserting the code into my web.config the pageSpeed did not improve.
The code I have uploaded was
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
And I have uploaded to my web.config file see code below:
Thanks for any help and merry x-mas guys.
Regards
Hi Pavol
Try to add cacheControlCustom="public" :
Also, it looks like google can do not make test again if you try to test the same url in a short period of time
Thanks,
Alex
Please post the error from Google Insights. I recently had quite a battle with Insights, so I might be able to help. I too added the "clientCache" code to my web.config along the way, but that was specifically for caching .svg files.
How did you get it to cache the SVGs? I need to do the same thing.
Add this to the
<staticContent>
section of the web.config did it for me (like OP did):Thanks Ole I was missing the cacheControlCustom attribute, but it still hasn't helped me.
https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fwww.codeshare.co.uk&tab=desktop
I see no issues related to .svg files?
Good point. It has fixed that issue now. Thanks. Still got the issue with the other ones though.
I'm pretty sure it's related to the ImageProcessor, try look at this:
With ImageProcessor, error is present: https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fwww.codeshare.co.uk%2Fmedia%2F1319%2Fhqdefault-3.jpg%3Fquality%3D30%26format%3Dpng8
Without ImageProcessor, error is gone: https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fwww.codeshare.co.uk%2Fmedia%2F1319%2Fhqdefault-3.jpg
Do you need to convert the images from jpg to png8? If not, try to remove that parameter from the image url.
I haven't experienced this myself, but I did struggle with Google wanting me to compress the images more. If you didn't already, you should add this: https://www.nuget.org/packages/ImageProcessor.Web.PostProcessor/
In
is working on a reply...