Forum Discussion
Magnum_IP
Nimbostratus
May 03, 2011Routing using the virtual command
I'm having a problem routing traffic using the virtual command on HTTPS and hope that someone can help.
I have everything working on HTTP I just can't get HTTPS to work.
Basically when a certain condition is met I want to change the URI and route the traffic back into the same virtual server without the user seeing a change in URL i.e. I don't want to use a 302 redirect.
I have sanitised this but something along the lines of
when HTTP_REQUEST {
...
if {$myVar < 1} {
HTTP::uri "/new.html"
virtual [virtual name]
}
}
I'm suspecting that the issue with HTTPS is to do with the Client/ServerSSL profiles, I was wondering if the ServerSSL profile was being used with the new connection to the virtual server. At any rate I get a Connection Reset.
Any ideas how I can solve or better troubleshoot my issue?
Regards,
fergu5
13 Replies
- L4L7_53191
Nimbostratus
I may be mistaken, but it reads like you're trying to send a connection back to the same virtual server it originated on - is this correct? If so, note that you can change the URI and simply send the request back to the pool member transparently (i.e., no vip targeting). Or, you may consider looking into the Proxypass iRule.
-Matt - Colin_Walker_12Historic F5 AccountMatt makes an excellent point, there's no reason at all to route back into the same virtual just to change a URI. The HTTP::uri command will do that transparently for you.
I'd be very careful when routing from an iRule back into the same VIP as you're asking for looping problems. If you want to share a bit more about what you're trying to do we could definitely help with alternate options.
Colin - Magnum_IP
Nimbostratus
Colin, L4L7,
A bit more by way of explanation...
I'm looking at extending the LTM Maintenance Page iRule in the code share http://devcentral.f5.com/wiki/default.aspx/iRules/LTMMaintenancePage.html
I have an iRule very similar to the one in the code share in production but when there are no active pool members and the Maintenance Page is invoked the user is redirected to the Maintenance Page URL.
http://www.domain.com/maintenancepage/index.html
What I would like to do in the situation where there are no active pool members is have the Maintenance Page display but the URL in the browser to remain as the URL the user browsed to - thus allowing the user to press F5 to refresh the page or alternatively use the http-equiv="refresh meta tag in the Maintenance Page to refresh the page periodically and in the event a pool member comes online, the true page the user wanted being displayed.
Any clearer? ;-)
fergu5 - Colin_Walker_12Historic F5 AccountAhhh, I see now.
So what I'd recommend is looking at moving the HTTP::respond line directly into the active members check, rather than performing a redirect first (going off the CodeShare entry you linked).
With the HTTP::respond command you can respond with whatever content you want (much like in the iRule you linked to in the codeshare) without having to redirect.
So basically, if it's viable, put the contents of your maintenance page in your iRule (or in a class that your iRule can reference) then respond with that instead of redirecting.
Like so:If the all members in the default pool are down, redirect to the maintenance page if { [active_members [LB::server pool]] < 1 } { HTTP::respond 200 content [lindex $::maint_index_html_class 0] "Content-Type" "text/html" } }
You could add any refresh you want there, or the user could continue to hit refresh as desired, and it should work just fine. This would basically do away with the "/" and "/index cases in the switch.
Does that make sense?
Colin - hoolio
Cirrostratus
I think Colin's answer is right, but if you're sending back maintenance content with an HTTP 200, make sure to set cache control headers so any intermediate proxies do not cache the response content:
HTTP::respond 200 content [lindex $::maint_index_html_class 0] "Content-Type" "text/html" "Cache-Control" "No-Cache" "Pragma" "No-Cache"
Aaron - Colin_Walker_12Historic F5 AccountYeah yeah, details. ;)
Aaron makes a good point, better safe than sorry.
Colin - Magnum_IP
Nimbostratus
Cool, thanks - I'll give this a whirl in my test environment tomorrow - I will attempt to incorporate all of the above. In my opinion it should lead to quite a sweet maintenance page experience, a nice functional improvement on the existing code share item.
If I get it working I might post it up as a revision in the code share - what do you think?
Colin - How did you get the box around your code excerpt above?
fergu5 - Colin_Walker_12Historic F5 AccountTo put the box around the code put it in code sections.
Like this (without the extra spaces):
[ code ]
your code goes here
[ / code ]
Colin - Magnum_IP
Nimbostratus
Got the updated Maintenence Page iRule working in my test environment but i think it would be good if you guys could take a look over it and give me your feedback.
Is the best thing for me to do to post an article up to the code share? As I haven't done that before - is it easy?
Thanks for all you help.
fergu5 - Magnum_IP
Nimbostratus
It was a steep learning curve ;-) but
LTMMaintenancePage_Refreshable
is now up on the CodeShare.
Thanks again for your help guys.
fergu5
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
