Forum Discussion
Stan_Hurton_111
Nimbostratus
Nov 30, 2016Redirect based on incoming port?
I'm trying to accomplish the following with an irule, without much luck. Can anyone help me achieve the following:
- If incoming request to port 8083 or 444 starts with '/sample', then forward request to url https://hostname.domain.com:7151
- If incoming request to port 8084 or 446 starts with '/sample', then forward request to url http://hostname.domain.com:7152
- If incoming request to port 8085 or 447 starts with '/sample', then forward request to url http://hostname.domain.com:7153
- If incoming request to port 8086 or 448 starts with '/sample', then forward request to url http://hostname.domain.com:7154
- If incoming request to port 80 or 443 starts with '/sample', then forward request to url http://hostname.domain.com:7150
Thanks, SH
- Vijay_E
Cirrus
Can you provide you iRule ? It will be easier to edit, if you already have something in place.
This is a rough template for you to tailor to your requirements:
when CLIENT_ACCEPTED { if { [string tolower [HTTP::uri]] starts_with "/sample" } { switch [TCP::local_port clientside] { 8083 - 444 { HTTP::respond 301 Location "https://hostname.domain.com:7151" } 8084 - 446 { HTTP::respond 301 Location "http://hostname.domain.com:7152" } 8085 - 447 { HTTP::respond 301 Location "http://hostname.domain.com:7153" } default { discard } } } }
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