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?
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 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.
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.
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.
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.
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:
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?
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?