October 14 2014

Leverage browser caching and add expires headers for Azure hosted WordPress

After a recent move to Azure, I was doing some performance testing for this blog via gtmetrix.com.  My reports were suggesting to ‘leverage browser caching’ and ‘add expires headers’ to improve my performance gradings.



This is usually straight forward to implement; it is simply a few lines added to the sites .htaccess file – either manually or by one of the many WordPress plugins that will update it for you:



Even after this was implemented, I noticed that it wasn’t making any difference to my performance reports – which got me thinking about Azure and that it would be running IIS in the backend and not Apache – and of course IIS doesn’t use the .htaccess file, it uses web.config instead.

After reading a few articles about translating .htaccess content to web.config, I was ready to go.  Using FTP, I edited the web.config file in my root directory and added the following lines:

<clientCache cacheControlMaxAge="28.00:00:00" cacheControlMode="UseMaxAge"/>
<add extension=".php" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="00:01:00:00" />
<add extension=".ttf" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
<add extension=".gif" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
<add extension=".jpg" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
<add extension=".png" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
<add extension=".js" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />
<add extension=".css" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="28:00:00:00" />

The configuration forces files to be cached on the client side for 28 days and 28 days on the server side except for .php files, which is only 1 hour.  I re-ran the performance grading reports and received a much better score!

Useful links:


I use a maximum of one Google Ad per post to help offset some of my blog hosting costs.


May 7 2012

SCCM package containing a plus (+) sign / symbol in a filename

When troubleshooting a package that wasn’t transferring from a SCCM DP to a BDP today, I realised that the filename had a plus (+) sign in it, eg BrushTip_+Round 10.PspScript. Bitsadmin reported:

ERROR CODE: 0x80190194 – The requested URL does not exist on the server.ERROR CONTEXT: 0x00000005 – The error occurred while the remote file was being processed.

The problem here is that with IIS requested URLs containing unencoded “+” characters in the path (not querystring) are rejected by default. Since we couldn’t rename the file, the workaround was to disable this validation by setting the allowDoubleEscaping attribute in the system.webServer/security/requestFiltering configuration section in the application’s web.config. Be aware that doing this may make your application more vulnerable to malicious URLs.



<requestFiltering allowDoubleEscaping=”true” />




See http://www.ifinity.com.au/Blog/entryid/60/404-error-in-iis-7-when-using-a-url-with-a-plus-sign-in-the-path for more info.



August 4 2011

Automate WebDAV configuration for SCCM site systems

This article here – http://technet.microsoft.com/en-us/library/cc431377.aspx – outlines how to configure IIS WebDAV for SCCM site systems. This is very fiddly manual process so I’ve created a small batch file to automate this. This is for Windows Server 2008 R2 with the correct IIS components already installed:

REM http://technet.microsoft.com/en-us/library/cc431377.aspx

REM Enable WebDav
%WinDir%System32InetSrvAppCmd.exe set config "Default Web Site/" /section:system.webServer/webdav/authoring /enabled:true /commit:apphost

REM Set authoring rule to allow all users read access
%WinDir%System32InetSrvAppCmd.exe set config "Default Web Site/" /section:system.webServer/webdav/authoringRules /+[users='*',path='*',access='Read'] /commit:apphost

REM Adjust WebDav settings

REM Hidden files
%WinDir%System32InetSrvAppCmd.exe set config "Default Web Site/" /section:system.webServer/webdav/authoring /fileSystem.allowHiddenFiles:true /commit:apphost

REM Anonymous properties
%WinDir%System32InetSrvAppCmd.exe set config "Default Web Site/" /section:system.webServer/webdav/authoring /properties.allowAnonymousPropfind:true /commit:apphost

REM Custom properties
%WinDir%System32InetSrvAppCmd.exe set config "Default Web Site/" /section:system.webServer/webdav/authoring /properties.allowCustomProperties:false /commit:apphost

REM Infinite depth
%WinDir%System32InetSrvAppCmd.exe set config "Default Web Site/" /section:system.webServer/webdav/authoring /properties.allowInfinitePropfindDepth:true /commit:apphost

January 12 2011

Outlook prompting for credentials with Exchange 2007

I saw this issue again today. Outlook 2007 & 2010 were prompting for username and password at startup and randomly during use.

I’ve used this fix a couple of times now. In IIS Manager navigate to the website that contains your Exchange Virtual Directories (In Exchange 2007 this is Default website, in SBS2008 this is SBS Web Applications)

In turn highlight the following Virtual Directories:


Once highlighted select Authentication, right click on Windows Authentication and select Advanced Settings and put a check in the enable kernel-mode authentication. Do this for each directory.

Careful as when upgrading to Exchange 2007 Service Pack 3, it reset the setting on 2 of the 4 directories, so these needed to be set back to enable kernel-mode authentication.