Forum Discussion
kng_107168
Nimbostratus
Mar 02, 2011unable to redirect to a different page on another pool
This is what I have but the client browser doesn't seems to like the redirection.
when HTTP_REQUEST {
if { [active_members poolA] < 1 } {
use pool poolB
HTTP::redirect "/splash.html"
}
}
Essentially I want the HTTP::host to be the same. I don't really care of the uri, whether the user sees the splash.html or not.
Can anyone point out what I'm doing wrong please?
Thanks in advance.
Ken
20 Replies
- Chris_Miller
Altostratus
HTTP::redirect sends the user an actual redirect. In your case, you're sending them to poolB but then redirecting them right to /splash. Redirects require protocol, hostname, and uri. So, "http://[HTTP::host]/splash.html" for example.
Can you describe what you're trying to do?
If there are no active members in poolA, what do you want to happen to the user? - kng_107168
Nimbostratus
splash.html is a static page with our maintenance hours. It is hosted on another web server in our private LAN. And I have put that web server into a separate pool. In my example, that would be poolB.
I think I can get around this by creating a dedicated virtual server with another real Internet IP. But I don't want to waste an IP address just for this purpose.
So here is a pseudo code of what I want to do.
- someone access https://my.server.com/login.jsp
irule:
if active_memebers of poolA < 0
then use poolB and use this page instead https://[http::host]/splash.html
Does this make sense? Or is there a better and easy way to do this?
Thanks. - Chris_Miller
Altostratus
Gotcha...yes, that makes sense. Try this.when HTTP_REQUEST { if { [active_members poolA] < 1 } { pool poolB HTTP::uri /splash.html } }
That will use poolB and also rewrite the user's request to /splash.html. - kng_107168
Nimbostratus
Thanks Chris. I had try this before but the browser doesn't dispaly the splash.html. This seems so simple but it's not working. Very frustrating.
Not sure this is related. I have another irule that forwards http to https. Would that be creating some conflict?
I guess if all else fails, I can use the "HTTP::respond 200 content \" method to display the maintenance details. However that means I have to edit this irule for every maintenance activities.
Any other thoughts? - Chris_Miller
Altostratus
If you're using a rule that redirects to HTTPS, then yes, it'll keep this rule from functioning properly.
You'd have the same problem using HTTP::respond though because the user would be redirected before the response was triggered...depending on how you've prioritized your iRules.
Are you redirecting all HTTP requests to HTTPS? Is this rule placed on your HTTP VIP or your HTTPS VIP or both? - kng_107168
Nimbostratus
Yes I am forwarding all http to https. The way that I do it is I created a virtual server that accepts connections on port 80. Then it has that https forwarding irule associated to that virtual server.
I guess I should worry too much about the https forwarding because our entire web application runs on https. So most users have probably bookmarked the https url.
And I have tried the HTTP::respond function and it works. But the web page is all text base and I can't include our company logo image on there. - Chris_Miller
Altostratus
Why not just keep the redirect iRule on the HTTP VIP and do the rule above on the HTTPS one? - kng_107168
Nimbostratus
hmmm if I understand you correctly, this is how I had it setup already. But the redirection is not working.
This is my http->https iRule that is assigned to the http vip:
when HTTP_REQUEST {
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
This is for my splash redirect on the https vip:
when HTTP_REQUEST {
if { [active_members poolA] < 1 } {
pool poolB
HTTP::uri /splash.html }
}
It seems the the web connection got reset so the client browser cannot download the splash page. - Chris_Miller
Altostratus
Are you terminating SSL on the LTM? - kng_107168
Nimbostratus
I'm using LTM to off load the SSL load. So I have a SSL profile setup on the LTM. Is that what you are asking?
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
