Getting rid of that pesky favicon.ico request

It’s a nifty little feature introduced into browsers way back when icons for your site were “cool”. The current version of chrome I’m using persists in asking the gateway for a /favicon.ico file with every request I send until it gets one. I can see this happening in the trace, real time monitoring interface and also in the new Traffic Monitor introduced in version 6.1.1 of the gateway. After a while it gets a little bit annoying, especially when you are trying to do something complicated where is less than helpful having a load of noise in the trace data. So with that in mind I thought I’d share how to “satisfy” the favicon.ico leach with the gateway (plus it’s pretty cool to have your own icon on the browser tab right?)

This introduces a feature of the gateway that enables it to serve static content. You can also host servlets and jsp pages, but that’s out of the scope of what we are doing here.

First of all make sure your gateway is started, then connect policy studio – if for some bizarre reason you haven’t done this yet then read this.

Start by creating a new policy (I recommend creating it under the “Policy Library” node, call it something sensible like “favicon.ico”.


Remember – policy names do not have to match uris, just organise and name them sensibly

All you are going to do in the policy is tell the gateway that it should look for static content (or a servlet) to serve up, this is done with the “call internal service” filter located in the “Routing” category.


Remember to use the category filter box at the top to make it easier to find the filter you are looking for

So our policy is this simple…


Now, because the favicon.ico file is located in the root directory i.e. we need to create a relative path on the gateway that can match this uri and then serve up our icon. The next step is to create the relative path /favicon.ico and map this to our policy. select the services category on the left and add a new relative path on the appropriate services node (I’m using the default here of *:8080)


Ok, so we now have a policy that will look to render static content when it receives a request on the /favicon.ico uri now we need to set up a “static content provider”

You can do this from the right click menu of the service node


or from the properties panel for the node.


Configuring the static content provider is relatively trivial, simply select the relative path that needs to be matched (in this case the root folder “/”) and select a directory from which to serve content.


Note that if you are planning to use this configuration on multiple gateways (on different OS) then it is advisable to use a relative path reference rather than an absolute.

Also…note the trailing slash on the end of the content directory – if you omit this, the content will not be served (this looks like a “featurette”)

Obviously we don’t want to allow directory browsing from the server root so I suggest leaving this unchecked.

In the example above I have used the folder C:\vordel\staticcontent\ which contains a single file called favicon.ico


All that remains it to deploy the configuration (click on the deploy icon, or press f6) and test the configuration – open http://localhost:8080/healthcheck/ with your browser and see that the icon is picked up as part of the request.


You can double check and see what is actually going on by looking in the traffic monitor http://localhost:8090/trafficmonitor/ and filtering by request path for /favicon.ico



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s