Forum Discussion
HY_37629
Nimbostratus
Jul 23, 2009Pool Selection base on HTTPS Request
Hello,
Newbie here...
Have a virtual server setup setup with client and server SSL.
Is it possible to direct httpS://www.x.com/a to pool a_pool and http://www.x.com/b to pool b_pool and default to x_pool
Thanks for your help
- The_Bhattman
Nimbostratus
Interesting question. - goyogi
Nimbostratus
Here's a similar request which should have the same answer... - goyogi
Nimbostratus
hyang... - goyogi
Nimbostratus
Sorry for the formatting. Cut and paste killed it. But it's small enough you should be able to decipher. - hoolio
Cirrostratus
You can use TCP::local_port to get the true requested port. I think URI::port and URI::host are intended to be used to parse absolute URIs (typically used when making requests to an HTTP proxy. You could use something like this to check the requested port, disable the client SSL profile if it's not needed and select the pool based on the requested URI:when CLIENT_ACCEPTED { Check the requested port switch [TCP::local_port] { "80" { Disable the client SSL profile SSL::disable } "443" { Leave the client SSL profile enabled } default { Take some action for other ports? For example, send a TCP reset reject } } } when HTTP_REQUEST { Check the requested URI switch -glob [HTTP::uri] { "/a*" { Check if requested port is 443 if {[TCP::local_port]==443}{ Select a_pool and stop processing this event in this iRule pool a_pool return } } "/b*" { Check if requested port is 80 if {[TCP::local_port]==80}{ Select b_pool and stop processing this event in this iRule pool b_pool return } } default { Send to default pool. This must be defined on port 0, with the pool members configured on the same HTTP HTTPS ports as the virtual server pool x_pool return } } If we made it here, the request was to /a and not via port 443 or to /b and not via port 80, so take some default action? HTTP::respond 403 Content {Unauthorized request} }
- HY_37629
Nimbostratus
Aaron, - hoolio
Cirrostratus
If there is a client SSL and HTTP profile, you can use an iRule to inspect and modify the HTTP content including the URI using the HTTP:: commands. Adding a server SSL profile makes no difference for this. - HY_37629
Nimbostratus
So if client sends a httpS://www.x.com/a request, HTTP:: commands will work as long as the SSL profile is check? - hoolio
Cirrostratus
That's correct. You'll need to import the server certificate and key in PEM format, configure them in a client SSL profile and add the profile to the HTTPS virtual server. You'd then be able to use the iRule above or any another HTTP:: commands on the HTTPS virtual server. - HY_37629
Nimbostratus
Aaron,
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