Forum Discussion
jdewing
Cirrus
Nov 05, 2009URI Redirection
I'm new to IRule. I need to write a IRule to redirect to a specific server in the pool based on the path.
For example, https://Server1.com/ExportData should redirect to https://192.168.1.10/ExportData. The virtual server is setup for load balancing with 3 servers. Only one server will have the ExportData. How can I redirect to the specific node?
Thanks in advance
- The_Bhattman
Nimbostratus
If you want to redirect the client to a specific server then you could do the followingwhen HTTP_REQUEST { if { [HTTP::uri] eq "/ExportData" } { HTTP::redirect "http://192.168.1.10/[HTTP::uri]" } }
- jdewing
Cirrus
Thanks for the quick response. - The_Bhattman
Nimbostratus
I misunderstood what you meant. If you mean forwarding to a specific node then you can do the followingwhen HTTP_REQUEST { if { [HTTP::uri] eq "/ExportData" } { node 192.168.1.10 80 } }
- jdewing
Cirrus
No luck! We are using https. I tried changed it to 443, still no luck. - The_Bhattman
Nimbostratus
What about the followingwhen HTTP_REQUEST { if { [HTTP::uri] contains "ExportData" } { node 192.168.1.10 443 } }
- jdewing
Cirrus
CB, - hoolio
Cirrostratus
Do you want to check the path (HTTP::path) or the query string (HTTP::query) for the exportdata string? The path is the URI minus the query string.when HTTP_REQUEST { if { [string tolower [HTTP::uri]] contains "exportdata" } { pool Servers_Pool member 192.168.1.10 80 } }
- The_Bhattman
Nimbostratus
To add the elimination of a variable that Aaron stats will in the long run execute the code faster. In this case it's more or less for simplicity. - jdewing
Cirrus
Thank Aaron & CB
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