Forum Discussion

Makengo_134399's avatar
Makengo_134399
Icon for Altostratus rankAltostratus
Oct 15, 2013

I would like clients coming requesting port 80 with /admin to be redirected to a different vs_B:8080 but by default to vs_A:80 HTTP Redirect Port

I have a problem

 

I would like clients coming requesting http://192.168.1.2 to be sent to virtual server vs_A (IP:192.168.1.2) and clients admin to be redirected to a different virtual server vs_B:8080 and different port. Which irule should I write to get it done.

 

3 Replies

  • Richard__Harlan's avatar
    Richard__Harlan
    Historic F5 Account

    This should work for you

     

    code when HTTP_REQUEST {
         if { [HTTP::uri] euqals "/admin" } {
            HTTP::redirect "http://vs_B:8080/admin
          }
     }
  • Thanks, this is working but we want external users to see http://example.genie.com/admin but not http://example.genie.com:8080/admin.

     

    So http://example.genie.com goes to Virtual server vs_A (Pool member 192.168.1.20 port 80) http://example.genie.com/admin goes to Virtual server vs_B (Pool member 192.168.1.21 port 8080) keeping the url as it is.

     

    • Richard__Harlan's avatar
      Richard__Harlan
      Historic F5 Account
      In that case all you need to do is change the pool code when HTTP_REQUEST { if { [HTTP::uri] euqls "/admin" } { pool vs_B_8080 } This will change where the request is sent but not change the URL that the customer is using. Now if you have to change the URI or the Host name to make this work you can use the HTTP::uri command to change the URI or change the Host header them self.