Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Clear all filters
Answers

Modify APM webtop favicon.ico

Hi All,

Can anyone give me their thoughts on customizing the favicon.ico file that APM provides? Right now it is the same for every service on the device, and I would like to be able to modify it on a per-access profile basis. I have attempted to try and do it via an iRule, but so far have only had some luck with APM in the way. I'm running 11.3.0 hf 6 and 11.4.0 hf3.

I see the original file at /usr/local/www/sam/webtop/favicon.ico, but I want to be able to override it altogether. For reference, I have uploaded a different file as an iFile called squares-favicon.

Here is my iRule attempting to replace the file. This worked until APM was added to the mix.

when HTTP_REQUEST {
    if { [HTTP::uri] eq "/favicon.ico" } {
        log local0. "Requested favicon"
        HTTP::respond 200 content [ifile get squares-favicon]
    }
}

Next I tried to add the ACCESS::restrict_irule_events command to try and work around it. This never really worked right either.

when CLIENT_ACCEPTED {
    ACCESS::restrict_irule_events disable
}
when HTTP_REQUEST {
    if { [HTTP::uri] eq "/favicon.ico" } {
        log local0. "Requested favicon"
        HTTP::respond 200 content [ifile get squares-favicon]
    }
}

Next I tried including the following in header.inc using the advanced customization editor, and modifying the iRule above to reflect the proper path (the URL below contains the IP of the VIP this is running on). This seems to work for Firefox but not Chrome or IE.

<link rel="shortcut icon" href="https://10.210.3.221/favicon.ico?v=2" />

Is there a way to customize the content between the head tags in an access profile? The highest I seem to be able to insert this tag is just after the head tags.

This definitely is a pretty janky solution so far. Hopefully someone can come up with something usable!

Thanks.

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Interesting. So this doesn't work for you?

when CLIENT_ACCEPTED {
    ACCESS::restrict_irule_events disable 
}
when HTTP_REQUEST {
    if { [HTTP::uri] equals "/favicon.ico" } {
        HTTP::respond 200 content [ifile get my_favicon] "Content-Type" "image/x-icon"
    }
}

I testing this successfully on 11.3 HF5

Any chance the favicon you're using is unsupported?

2
Comments on this Answer
Comment made 11-Sep-2013 by Josh Becigneul 1232
Excellent. That seems to have done the trick. I was previously using a PNG, so I swapped in a Microsoft ICO format file and added the Content-type as you have above. Seems to work flawlessly now. I wonder if Firefox is more lax about the file format requred. Thank you!
0
Comment made 11-Sep-2013 by Lucas Thompson
A few more things about this: 1- Apple iOS devices and also Chrome (some versions) use some other files for the website icons, "apple-touch-icon-precomposed.png" and "apple-touch-icon.png". You may want to apply the same sort of solution for those. 2- Because you are disabling Access on these flows, you should add an "HTTP::close" before your HTTP::respond, so that additional HTTP requests cannot be made in the same connection. HTTP::close does not immediately close the connection as the command name implies, it instead performs a Connection: close so the HTTP cannot be used again for more requests.
0
Comment made 07-Nov-2014 by Walter Kacynski 978
I don't believe that you are bypassing the Access Policy. You are just instructing APM to give you access to the HTTP_REQUEST event.
0
Comment made 22-Jan-2015 by Walter Kacynski 978
Would it be possible to serve the content from a pool of backend servers rather than thru an iFile?
0
Comment made 30-Jun-2015 by Walter Kacynski 978
I have discovered that setting the Connection close header is critical since if you do not, APM will allow the next request to flow to the backend.
0
Comment made 15-May-2018 by Nolan Jensen 159

I am able to replace the favicon.ico file located /var/sam/www/webtop/ but when I do this it changes the favicon for all access policies.

I tried the iRule above but not sure how to get it to point at just an .ico file and where that ico file should be stored.

I added my custom image to /var/sam/www/webtop/WebTopfav.ico and then tried the below iRule to get it to replace it for the specific virtual server but no luck.

Any ideas or help on what I am doing wrong?

when CLIENT_ACCEPTED { ACCESS::restrict_irule_events disable } when HTTP_REQUEST { if { [HTTP::uri] equals "/favicon.ico" } { HTTP::respond 200 content /var/sam/www/webtop/WebTopfav.ico "Content-Type" "image/x-icon" } }

Thank you

0
Comment made 31-Jul-2018 by Nolan Jensen 159

For anyone who comes across this I was able to get it to work and here is what I was missing before.

go to Local Traffic > iRules > iFile list > Create > and upload the webtopfav.ico file you want to be used for your webtop.

Then your iRule should look like this like was stated above.

when CLIENT_ACCEPTED {
    ACCESS::restrict_irule_events disable 
}
when HTTP_REQUEST {
    if { [HTTP::uri] equals "/favicon.ico" } {
        HTTP::respond 200 content [ifile get webtopfav] "Content-Type" "image/x-icon"
    }
}

Once that is complete attach that irule to your virtual server Local Traffic > virtual servers > Name of virtual server > resources > iRules section (Manage)

0