Forum Discussion

tihi_341714's avatar
tihi_341714
Icon for Nimbostratus rankNimbostratus
Feb 06, 2018

Based on URI path redirect to different port

Hi,

 

I'm kinda new to F5 and the LTM module so I'm trying to wrap my head around iRules and policies. I've got a task I can't seem to solve however easy it might be. I tried searching the existing topics but without luck.

 

A webserver with two nodes is listening on port 80 and 443. When http is accessed the F5 should redirect the connection to https. I can do this with the inbuilt irule.

 

The pools behind the HTTPS virtual server are listening on 8443 so the connection is like this: https:// xy.com/ goes to POOL_SOMETHING:8443.

 

And here comes the twist. When the URL contains this path: /auth then instead of 8443 the connection should be redirected to 9443. Like this: https:// xy.com/auth goes to POOL_SOMETHING:9443

 

What I thought would be a good solution is to create two pools. POOL_SOMETHING:8443 and POOL_SOMETHING:9443. Then, I would create an LTM policy where the following conditions would be enabled:

 

HTTP URI path is any of /auth THEN Forward traffic to pool POOL_SOMETHING:9443

 

Is this a reasonable solution?

 

If not, can you please suggest something?

 

Thanks in advance!

 

5 Replies

  • Hi,

     

    As far as I know your approach is correct and you can use irules to handle redirection issues.

     

    Also you should consider the following link: Policies and iRules

     

    • tihi_341714's avatar
      tihi_341714
      Icon for Nimbostratus rankNimbostratus

      Thank you for the info and the link, I'm reading it now. Have a nice day.

       

  • oguzy's avatar
    oguzy
    Icon for Cirrostratus rankCirrostratus

    Hi,

     

    As far as I know your approach is correct and you can use irules to handle redirection issues.

     

    Also you should consider the following link: Policies and iRules

     

    • tihi_341714's avatar
      tihi_341714
      Icon for Nimbostratus rankNimbostratus

      Thank you for the info and the link, I'm reading it now. Have a nice day.

       

  • Don’t forget to assign the other pool in a default policy rule below.

     

    • Virtual server pool assignment is layer 4 (assigned once for the whole tcp connection)
    • Policy pool assignment is layer 7

    If you don’t create a rule to fallback to the default pool, the tcp connection will stay on the previously assigned pool.