Return default favicon.ico
Problem this snippet solves:
A simple iRule that redirects the user to the main favicon file. This could be greatly expanded, but it came in handy for sites that did not have a favicon (in a virtual hosting environment). A more robust implementation would be to check for a 404 and see if the page requested was favicon, then send the file. That way, if the virtual hosted site DOES have their own favicon file, the browser would get that.
How to use this snippet:
Note: I'm not sure a browser will follow a redirect for favicon.ico requests. It might be better to rewrite any requested URI ending in /favicon.ico to exactly /favicon.ico. (Aaron)
Code :
when HTTP_REQUEST { #Thomas Schaefer, Better Software Solutions, Inc. # A crazy simple iRule to redirect any favicon.ico requests to the favicon on your homepage # This promotes a uniform presentation. # Note this could be expanded to server the data right from the iRule (think external data class) if {[HTTP::path] ends_with "/favicon.ico"}{ HTTP::redirect "http://www.mycompany.com/favicon.ico" } }
Published Mar 18, 2015
Version 1.0Thomas_Schaefer
Nimbostratus
Joined May 24, 2006
Thomas_Schaefer
Nimbostratus
Joined May 24, 2006
No CommentsBe the first to comment