I would like to create one virtual server that uses a network segment to support all incoming http requests. The majority of my company’s http traffic is redirected to https. I’ve come up with four different iRules that could be used to support the various redirects, including one to simply forward traffic to the correct pool.
Can I consolidate the following iRules into one iRule? And, does it even make sense to do this?
Do you have an HTTP and an HTTPS virtual server? Which iRules are for HTTP requests and which are for HTTPS? Do you have a pool of webservers that answer for all web applications on the network segment you refer to?
The majority of our public facing sites are built with two virtual servers; one listening on port 80 and the other listening on port 443. We’re using a class C block for all the virtuals. The webservers are segmented into different vlans according to the application being supported.
What I would like to accomplish is to get away from creating virtual servers listening on port 80 that are primarily used to redirect http traffic to https. Setting up one virtual server that uses our virtual IP network segment with a port 80 listener seemed like a good start. Then, applying the four iRules above to that virtual server will allow the F5 to direct http requests to the correct https URI as they hit the VIP. I can configure the iRules to redirect http requests based on the domain name or URI content for any traffic coming in on that class C block.
Thanks Hoolio. This appears to be exactly what I need. I’m definitely going to need the logging when testing, I appreciate that. But, I especially appreciate you adding the “return” command. It never dawned on me that the iRule processing would continue evaluating each condition after a match was found.