Forum Discussion
URI Redirect with server pool condition
Hi Dev/central,
First of all, thanks for all of your assistance up until this point but I can't find anything to fit the bill on this one.
Description of the problem:
We have a single VS, which load balances a number of web applications via the LTM policy. We are using cookie persistence which is breaking one of our applications when chrome automatically requests /favicon.ico from the root directory when a new tab is opened. The larger problem will be resolved in work coming up but I'm looking for a quick fix as it's affecting users.
Essentially what I'm trying to achieve with an iRule is to redirect /favicon.ico to /other/favicon.ico, only when it's requested to a particular pool which I believe would look something like this, however it's not working.
when HTTP_REQUEST {
if { [[LB::server name] equals poolname] }{
if { [string tolower [HTTP::host]] eq "www.website.com" and [HTTP::path] eq "/favicon.ico" } {
HTTP::respond 301 Location "https://www.website.com/other/favicon.ico"
}
}
Any help is greatly appreciated.
- Benjiman
2 Replies
Not seen above iRule. But you can try something like this.
when CLIENT_ACCEPTED { if { ([llength [active_members -list poolname]] < 1) and ([HTTP::path] eq "/favicon.ico") } { HTTP::respond 301 Location "https://www.website.com/other/favicon.ico" } }- Benjiman
Nimbostratus
Hi Samir,
Thanks for the quick response but unfortunately the iRule doesn't work. I received the following error when attempting to use it.
01070151:3: Rule [/Common/ASID103898_pool_redirect] error: /Common/ASID103898_pool_redirect:3: error: [command is not valid in current event context (CLIENT_ACCEPTED)][HTTP::respond 301 Location "https://www.website.com/other/favicon.ico"]
/Common/ASID103898_pool_redirect:2: error: [command is not valid in current event context (CLIENT_ACCEPTED)][HTTP::path]
Could I please also clarify that there's an LTM policy that utilises a lot of pools on this VS, the iRule has to be specific to the current session, so that it doesn't impact the other VS connections.
Thanks!
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com