# Redirect

**URL:** <https://community.f5.com/t/redirect/16267>\
**Category:** Technical Forums\
**Tags:** dev, irules, devops, application-delivery\
**Created:** [August 21, 2012, 1:04am UTC](https://community.f5.com/t/redirect/16267 "2012-08-21T01:04:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![crush09\_18103](https://avatars.discourse-cdn.com/v4/letter/c/57b2e6/32.png) [@crush09\_18103](https://community.f5.com/u/crush09_18103)\
**Post date:** [August 21, 2012, 1:04am UTC](https://community.f5.com/t/redirect/16267/1 "2012-08-21T01:04:17Z")

</div>

So this is what I’m trying to do… We have a production webpage (virtual server/pool) with basic health monitors. We have a maintenance webpage (virtual server/pool). So the application guys want to be able to change the header on the maintenance webpage to contain the word “down” and when that happens they want the production webpage to redirect to the maintenance webpage. And flip back over when they remove the word “down.”

Any help would be much appreciated…

---

<div class="post-metadata">

**Author:** ![nitass](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/nitass/32/2270_2.png) [@nitass](https://community.f5.com/u/nitass)\
**Post date:** [August 21, 2012, 1:25am UTC](https://community.f5.com/t/redirect/16267/2 "2012-08-21T01:25:54Z")

</div>

is the example irule in sol6510 applicable?

sol6510: BIG-IP system fallback host behavior when a host is down

> **[404 Page not found | BIG-IP Documentation](https://techdocs.f5.com/kb/en-us/solutions/public/6000/500/sol6510.html)**
>
> Usage information and technical documentation for BIG-IP and other related F5 products

---

<div class="post-metadata">

**Author:** ![crush09\_18103](https://avatars.discourse-cdn.com/v4/letter/c/57b2e6/32.png) [@crush09\_18103](https://community.f5.com/u/crush09_18103)\
**Post date:** [August 21, 2012, 1:34am UTC](https://community.f5.com/t/redirect/16267/3 "2012-08-21T01:34:00Z")

</div>

No. They want to have the word “down” in the header (really meaning they made the maintenance page they want available) on the maintenance VS and when that maintenance page is available they want the production VS to redirect to that very maintenance page.

Appreciate the quick response.

---

<div class="post-metadata">

**Author:** ![nitass](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/nitass/32/2270_2.png) [@nitass](https://community.f5.com/u/nitass)\
**Post date:** [August 21, 2012, 8:53am UTC](https://community.f5.com/t/redirect/16267/4 "2012-08-21T08:53:45Z")

</div>

e.g.

172.28.19.79 is production virtual

200.200.200.101 is production pool

172.28.19.89 is maintenance virtual

```tcl
[root@ve10:Active] config b virtual prod list
virtual prod {
   snat automap
   pool prodpool
   destination 172.28.19.79:80
   ip protocol 6
   rules myrule
   profiles {
      http {}
      tcp {}
   }
}
[root@ve10:Active] config b pool prodpool list
pool prodpool {
   monitor all myhttp
   members 200.200.200.101:80 {}
}
[root@ve10:Active] config b monitor myhttp list
monitor myhttp {
   defaults from http
   dest 172.28.19.89:80
   reverse
   recv "down"
   send "GET /test.html HTTP/1.1\r\nHost: \r\nConnection: Close\r\n\r\n"
}
[root@ve10:Active] config b rule myrule list
rule myrule {
   when HTTP_REQUEST {
   if {[active_members [LB::server pool]] < 1} {
     HTTP::fallback "http://172.28.19.89"
   }
}
}

[root@ve10:Active] config curl http://172.28.19.89/test.html
down

[root@ve10:Active] config b pool prodpool|grep -i pool
POOL prodpool LB METHOD round robin MIN/CUR ACTIVE MEMBERS 0/0
+-> POOL MEMBER prodpool/200.200.200.101:80 inactive,down

[root@ve10:Active] config curl -I http://172.28.19.79
HTTP/1.0 302 Found
Location: http://172.28.19.89
Connection: close

```

---

<div class="post-metadata">

**Author:** ![nitass](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/nitass/32/2270_2.png) [@nitass](https://community.f5.com/u/nitass)\
**Post date:** [August 21, 2012, 8:56am UTC](https://community.f5.com/t/redirect/16267/5 "2012-08-21T08:56:45Z")

</div>

another way.

```tcl
[root@ve10:Active] config b virtual prod list
virtual prod {
   snat automap
   pool prodpool
   destination 172.28.19.79:80
   ip protocol 6
   rules myrule
   profiles {
      http {}
      tcp {}
   }
}
[root@ve10:Active] config b rule myrule list
rule myrule {
   when HTTP_REQUEST {
   if {[LB::status pool foo member 172.28.19.89 80] eq "up"} {
      HTTP::redirect "http://172.28.19.89"
   }
}
}
[root@ve10:Active] config b pool foo list
pool foo {
   monitor all myhttp
   members 172.28.19.89:80 {}
}
[root@ve10:Active] config b monitor myhttp list
monitor myhttp {
   defaults from http
   dest 172.28.19.89:80
   recv "down"
   send "GET /test.html HTTP/1.1\r\nHost: \r\nConnection: Close\r\n\r\n"
}

[root@ve10:Active] config curl http://172.28.19.89/test.html
down

[root@ve10:Active] config b pool foo|grep -i pool
POOL foo LB METHOD round robin MIN/CUR ACTIVE MEMBERS 0/1
+-> POOL MEMBER foo/172.28.19.89:80 active,up

[root@ve10:Active] config curl -I http://172.28.19.79
HTTP/1.0 302 Found
Location: http://172.28.19.89
Server: BigIP
Connection: Keep-Alive
Content-Length: 0

```

---

<div class="post-metadata">

**Author:** ![smp\_86112](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@smp\_86112](https://community.f5.com/u/smp_86112)\
**Post date:** [August 21, 2012, 2:36pm UTC](https://community.f5.com/t/redirect/16267/6 "2012-08-21T14:36:24Z")

</div>

I’m not sure I fully comprehend your requirements. But how about this -

Apply a second monitor to the production pool which hits the maintenance pool members (using the Alias Address/Alias Service Port options if necessary), and leaving the Availability Requirement set to All. When the maintenance monitor goes down (by “changing the header”), that will trigger the LB\_FAILED event on the production VIP. Then you can catch it with an iRule:

when LB\_FAILED {

HTTP::redirect “http://(maintenance URL)”

}

---

<div class="post-metadata">

**Author:** ![crush09\_18103](https://avatars.discourse-cdn.com/v4/letter/c/57b2e6/32.png) [@crush09\_18103](https://community.f5.com/u/crush09_18103)\
**Post date:** [August 21, 2012, 4:49pm UTC](https://community.f5.com/t/redirect/16267/7 "2012-08-21T16:49:47Z")

</div>

That’s exactly what I tried to do. Having issues with getting their header. Are you sure that we can apply a health monitor to a Virtual server that then points to another site (is that what the alias does?) also what about persistance? I’m told that even if the members are down, persistant connections will still go to them.

---

<div class="post-metadata">

**Author:** ![smp\_86112](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@smp\_86112](https://community.f5.com/u/smp_86112)\
**Post date:** [August 21, 2012, 5:31pm UTC](https://community.f5.com/t/redirect/16267/8 "2012-08-21T17:31:43Z")

</div>

The health monitor is applied to a Pool, not a Virtual Server. But yes, the Alias fields say, in effect, “check this ip address/port instead of the ip/port of the members in the pool where it’s applied”. But what I would do first is create a bogus pool with the maintenance members and apply the maintenance monitor there. That way, you’re not fussing with the production pool.

There could be a number of issues around “getting the header” (still not 100% confident I understand what that means exactly, but I think I do). One thing I know for certain is that the LTM only looks for the Receive String in the the first 5120 bytes of the HTTP response - the response headers are included in that 5120 limit. But assuming it’s not that or something like a firewall or routing issue, typically what I would do is perform a tcpdump and see exactly how the maintenance server is responding on the wire. This is something I do all the time, but not everyone knows how to do this or analyze the output. I can help if needed if you feel comfortable sharing a network trace. You may be able to send me a private message with attachment if you don’t want to post it to everyone.

(edit)

Also I forgot to answer your persistence question. I think when the Virtual Server is marked down, it will still trigger the LB\_FAILED event even if the connection is persistent because when the VS is down, the LTM has nowhere to send the traffic. You should test this though.

---

<div class="post-metadata">

**Author:** ![smp\_86112](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@smp\_86112](https://community.f5.com/u/smp_86112)\
**Post date:** [August 21, 2012, 5:49pm UTC](https://community.f5.com/t/redirect/16267/9 "2012-08-21T17:49:52Z")

</div>

That’s exactly what I tried to do. Having issues with getting their header.

Also, post what LTM version you are running and your maintenance monitor Send and Receive Strings - sanitize if necessary. It’s possible you arent using the correct CR/LF line-termination characters.

---

<div class="post-metadata">

**Author:** ![crush09\_18103](https://avatars.discourse-cdn.com/v4/letter/c/57b2e6/32.png) [@crush09\_18103](https://community.f5.com/u/crush09_18103)\
**Post date:** [August 22, 2012, 1:29am UTC](https://community.f5.com/t/redirect/16267/10 "2012-08-22T01:29:38Z")

</div>

Everything with the redirect irule works. The problem is I cannot get the health monitor to work.

The app guys gave me this.

[https://testmaint.xyz.com/getwebsit…x?env=test](https://testmaint.xyz.com/getwebsitestatus.aspx?env=test)

If I go to this webpage with a Internet browser, it says “down” in the body.

So I created this for the send string

GET / HTTP/1.1\nHost: [.xyz Domain Names | Join Generation XYZ](http://testmaint.xyz.com/getwebsitestatus.aspx?env=test)\nConnection: close\n\n\r\n

and a receive string

down

-------

For alias address it just has this and I cannot change anything.

Alias Address \* All Addresses

Alias Service Port \* All Ports

\_\_\_\_\_\_\_\_\_

BIG-IP 10.2.3 Build 112.0 Final

---

<div class="post-metadata">

**Author:** ![nitass](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/nitass/32/2270_2.png) [@nitass](https://community.f5.com/u/nitass)\
**Post date:** [August 22, 2012, 1:38am UTC](https://community.f5.com/t/redirect/16267/11 "2012-08-22T01:38:10Z")

</div>

GET / HTTP/1.1\nHost: [.xyz Domain Names | Join Generation XYZ](http://testmaint.xyz.com/getwebsitestatus.aspx?env=test)\nConnection: close\n\n\r\ncan you try this?

GET /getwebsitestatus.aspx?env=test HTTP/1.1\r\nHost: [testmaint.xyz.com](http://testmaint.xyz.com)\r\nConnection: close\r\n\r\n

sol2167: Constructing HTTP requests for use with the HTTP or HTTPS application health monitor

> **[404 Page not found | BIG-IP Documentation](https://techdocs.f5.com/kb/en-us/solutions/public/2000/100/sol2167.html)**
>
> Usage information and technical documentation for BIG-IP and other related F5 products

by the way, it is https monitor, isn’t it?

For alias address it just has this and I cannot change anything.you have to create a new one i.e. you cannot change it after creating.

---

<div class="post-metadata">

**Author:** ![crush09\_18103](https://avatars.discourse-cdn.com/v4/letter/c/57b2e6/32.png) [@crush09\_18103](https://community.f5.com/u/crush09_18103)\
**Post date:** [August 22, 2012, 2:29am UTC](https://community.f5.com/t/redirect/16267/12 "2012-08-22T02:29:46Z")

</div>

What would I put in the alias address anyway.The actual IP of the [testmaint.xyz.com](http://testmaint.xyz.com) website?

---

<div class="post-metadata">

**Author:** ![nitass](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/nitass/32/2270_2.png) [@nitass](https://community.f5.com/u/nitass)\
**Post date:** [August 22, 2012, 2:31am UTC](https://community.f5.com/t/redirect/16267/13 "2012-08-22T02:31:31Z")

</div>

What would I put in the alias address anyway.The actual IP of the [testmaint.xyz.com](http://testmaint.xyz.com) website?yes and alias service port should be 443.

---

<div class="post-metadata">

**Author:** ![crush09\_18103](https://avatars.discourse-cdn.com/v4/letter/c/57b2e6/32.png) [@crush09\_18103](https://community.f5.com/u/crush09_18103)\
**Post date:** [August 22, 2012, 3:07am UTC](https://community.f5.com/t/redirect/16267/14 "2012-08-22T03:07:47Z")

</div>

Thanks SMP and nitass,

I got it to work…

Smp when you came up with the same logic I was trying I knew I was on the right track. People I work with did not agree.

nitass thanks for the GET, i knew it was a problem and just didn’t know the correct syntax.

In the alias I put the IP address of the website and the port 443. The health monitor worked then i used reverse and lo and behold it did what i wanted.

THANKS AGAIN!!!

---

<div class="post-metadata">

**Author:** ![smp\_86112](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@smp\_86112](https://community.f5.com/u/smp_86112)\
**Post date:** [August 22, 2012, 12:57pm UTC](https://community.f5.com/t/redirect/16267/15 "2012-08-22T12:57:05Z")

</div>

You are welcome. However, I was thinking through my recommendation a bit, and there might be an implication you should be aware of depending on how you have it configured. Do you have two monitors on the pool, or just the maintenance monitor? If you have two monitors on the pool and are using the iRule I suggested, then if EITHER monitor fails you will get redirected to the maintenance page - not just when the maintenance monitor fails. That may not be the behavior you want. If you only apply the maintenance monitor, then it’s not an issue. But if you want different behavior depending on which monitor fails, then we might need to come up with something else.

---

<div class="post-metadata">

**Author:** ![crush09\_18103](https://avatars.discourse-cdn.com/v4/letter/c/57b2e6/32.png) [@crush09\_18103](https://community.f5.com/u/crush09_18103)\
**Post date:** [August 22, 2012, 2:35pm UTC](https://community.f5.com/t/redirect/16267/16 "2012-08-22T14:35:26Z")

</div>

SMP you read my mind, my plan was to alter the irule. Strange that we think alike, kinda scary. I’m not a TCL guy, I’m a network guy and I get the logic but I don’t know the code. So here is the deal

I have two health monitors

Health1

Health2

Here is my irule.

when LB\_FAILED {

HTTP::fallback “[.xyz Domain Names | Join Generation XYZ](https://testmaint.xyz.com/default.htm)”

}

There has got to be a way to include Health2 as being down as a criteria for when to fallback within the irule.

I’m hoping you or Nitass can assist. Judging by Nitass’s input he knows TCL like the back of his hand.

---

<div class="post-metadata">

**Author:** ![nitass](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/nitass/32/2270_2.png) [@nitass](https://community.f5.com/u/nitass)\
**Post date:** [August 22, 2012, 3:51pm UTC](https://community.f5.com/t/redirect/16267/17 "2012-08-22T15:51:13Z")

</div>

what about if using only health1 on production pool, health2 on maintenance pool and then in production irule, using “LB::status pool” command to see if maintenance pool is up or down and redirect accordingly?

just my 2 cents.

---

<div class="post-metadata">

**Author:** ![crush09\_18103](https://avatars.discourse-cdn.com/v4/letter/c/57b2e6/32.png) [@crush09\_18103](https://community.f5.com/u/crush09_18103)\
**Post date:** [August 22, 2012, 7:12pm UTC](https://community.f5.com/t/redirect/16267/18 "2012-08-22T19:12:06Z")

</div>

So if I created another pool without a VS and called it “health\_pool” (i can use the same IPs of the maintenance page pool) then use that special monitor I created to get the website “down” message which would take down the health\_pool. Then, i could go to the prod pool and put in an irule. Can i reference a pool that is not the same pool as where I’m applying the irule? So what would that Irule look like under the prod pool?

when LB\_FAILED {

if { [LB::status pool health\_pool] eq down}{

HTTP::fallback “[.xyz Domain Names | Join Generation XYZ](https://testmaint.xyz.com/default.htm)”

---

<div class="post-metadata">

**Author:** ![nitass](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/nitass/32/2270_2.png) [@nitass](https://community.f5.com/u/nitass)\
**Post date:** [August 22, 2012, 8:55pm UTC](https://community.f5.com/t/redirect/16267/19 "2012-08-22T20:55:28Z")

</div>

Can i reference a pool that is not the same pool as where I’m applying the irule? So what would that Irule look like under the prod pool? yes but i understand you also have to specify pool member.

e.g.

LB::status pool (name) member (ip) (port)

LB::status wiki

> **[DevCentral](https://community.f5.com/)**
>
> DevCentral is an online technical community where engineers and practitioners collaborate, share knowledge, and solve problems related to F5 technologies and industry trends.

and you should use HTTP\_REQUEST event instead of LB\_FAILED since on production, it does not fail.

---

<div class="post-metadata">

**Author:** ![crush09\_18103](https://avatars.discourse-cdn.com/v4/letter/c/57b2e6/32.png) [@crush09\_18103](https://community.f5.com/u/crush09_18103)\
**Post date:** [August 22, 2012, 10:01pm UTC](https://community.f5.com/t/redirect/16267/20 "2012-08-22T22:01:24Z")

</div>

Something like this.

when HTTP\_REQUEST {

if { [LB::status pool health1 member x.x.x.x 443] eq down}{

HTTP::fallback “[.xyz Domain Names | Join Generation XYZ](https://testmaint.xyz.com/default.htm)”

}

}

or like this

when HTTP\_REQUEST {

if { [LB::status pool health1 member x.x.x.x 443] eq down}{

HTTP::redirect “[.xyz Domain Names | Join Generation XYZ](https://testmaint.xyz.com/default.htm)”

}

}

The only problem I worry about is with persistance. Which will happen. When I did it the other way persistance caused a problem but since I had a health monitor I was able to force a reset when the pool went down and then redirect to the new page. I won’t have that option this way. Unless I can include something in this irule.

[Next page](https://community.f5.com/t/redirect/16267.md?page=2)
