Forum Discussion
Bob_10976
Nimbostratus
Jul 12, 2010iRule to use specific server based on URL/URI request
Hello all..
When the request for https://hostdomain.com/project is requested I need to go direct and only one of the nodes in the assoicated pool. I can't have any other request go to this new node being added, at least not yet. The only request this new server is going to serve will be /projects I need all other request to go to the current node that has beeing serving the request previously.
Any suggestions on how to wright this iRule?
Thanks,
Bob
- hoolio
Cirrostratus
Hi Bob,when HTTP_REQUEST { Check the requested path with wildcard matching switch -glob [HTTP::path] { "/project*" { /project URI pool project_pool } default { non-/project URI pool default_pool } } }
- Bob_10976
Nimbostratus
Thanks Aaron..Thats a much better way... - hoolio
Cirrostratus
The iRule should work for any version. And yes, you should be able to change the pool command to the virtual command. Out of curiosity, why do you want to use a separate VS for the /projects requests? - Bob_10976
Nimbostratus
Thanks Aaron... - Bob_10976
Nimbostratus
It appears I'm doing something wrong, below is the code I'm using and I found two problems with it. Fist if I leave in the "default" section of the code than none of my applications/websites related to this site work. This is probably because all the vitural directories that hang off my web site, exist in a format such as: https://secure.domain.com/carpool, or /Bob or /tools, etc.. Since there is no default I took that section out. However with or with out that section the redirection is not happening. No errors messages jump out at me as being issue, not sure how to troubleshoot irules... Any suggestions?when HTTP_REQUEST { Check the requested path with wildcard matching switch -glob [HTTP::path] { "/project*" { /project URI virtual vs_new_Secure_Server_https } default { non-/project URI virtual vs_Old_Secure_Server_https } } }
- hoolio
Cirrostratus
Hi Bob, - Bob_10976
Nimbostratus
Aaron... - hoolio
Cirrostratus
If you create two separate pools, you can create two corresponding HTTP classes. The first class would check for paths (URIs) matching /project* and have the /project pool assigned. The second HTTP class would have no filters and have the VS's default pool assigned. The project HTTP class would look like this in the bigip.conf:profile httpclass project_httpclass { defaults from httpclass pool project_http_pool redirect none paths "/project*" }
when CLIENT_ACCEPTED { Save the name of the VS default pool set default_pool [LB::server pool] } when HTTP_REQUEST { Check the requested path with wildcard matching switch -glob [HTTP::path] { "/project*" { /project URI pool project_http_pool } default { non-/project URI pool $default_pool } } }
- Bob_10976
Nimbostratus
Thanks Aaron...I'll look into both those options, and let you know how it goes. - Bob_10976
Nimbostratus
Aaron...So close!
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