Forum Discussion
Is iRule the correct method?
Thanks for the link to the manual, however I couldn't seem to get the LTM configured how I like so I opted to go for an iRule to try and do this. The iRule seems to work, however I noted that on my any alternate statements it doesn't appear to be working. The iRule I have configured is something similar to the following. A reminder of what I am trying to do first
1) External user connects to abc.com/prod. The F5 then reverse proxies this (nat'd) to the internal server on port 1234 2) External user connects to abc.com/dev. The F5 then reverse proxies this to the internal server on port 4567.
So with the above in mind, I wrote an iRule such as:
when HTTP_REQUEST { if { [HTTP::uri starts_with "/prod"} {pool server1 port-1234} if { [HTTP::uri starts_with "/test"} {pool server1 port-4567} if { [HTTP::uri starts_with "/dev} {HTTP::redirect "https://example.com"} else {pool server1 port-1234} }
I think the above is missing an operator between the IF statements and is likely the cause of my problem. The IF statements gets me a result at least for where I am going (I noted if I put say the HTTP redirect in the first if statement) it would actually do the redirect. However in the form it is above, it doesn't seem to work.
I am using the virtual server as a standard type and piping this via an APM configuration. The APM configuration is basically "Start" ==> "Pool Assign" ==> "Allow". However it is likely that I will remove the APM configuration as this really is just an LTM configuration. It is also likely that I will remove the Pool that I created for the server and instead just use the iRule to do a "node" instead of "pool". So effectively the iRule would change to
when HTTP_REQUEST { if { [HTTP::uri starts_with "/prod"} {node 10.10.10.10 1234} if { [HTTP::uri starts_with "/test"} {node 10.10.10.10 4567} if { [HTTP::uri starts_with "/dev} {node 10.10.10.10 8911} else {node 10.10.10.10 1234} }
So where in my if statement am I wrong?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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