Forum Discussion
If URL contains [blank] redirect to original URL @ different port
Hi folks,
I'm trying to setup what I believe is a fairly simple redirect iRule but a total lack of experience has me stumped. Here's what I'm trying to accomplish:
If a client hits a URL containing "synchrony" then they will be redirected to the same URL with port 8091.
As an example:
- client hits - http://test.co/synchrony
- then redirect to - http://test.co:8091/synchrony
or
- client hits - http://test.co/synchrony/v1/test/example
- then redirect to - http://test.co:8091/synchrony/v1/test/example
Here's the iRule I'm currently using:
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] contains "/synchrony" && [TCP::local_port] == 80 } { HTTP::redirect "http://[getfield [HTTP::host] ":" 1]:8091/[URI::basename [HTTP::uri]]" } }
...which works fine on the first example, but fails if the url contains anything after "/synchrony".
Any guidance would be greatly appreciated.
Recent Discussions
Related Content
* 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