Forum Discussion

ckteur's avatar
ckteur
Icon for Cirrus rankCirrus
Jan 31, 2024

Solution to rewrite URL by URI, forwarding on pools and send server name SNI to backend

Hello everybody,

I have only one VS that used by some URLs and I need to: 

 

  • Rewrite urls by uri


https://urlorigin/asse/1/     -->   https://urldest-asse1.hppaas.com/

https://urlorigin/asse/2/     -->  https://urldest-asse2.hppaas.com/

https://urlorigin/tfon/1/     -->    https://urldest-tfon1.hppaas.com/

 

  • Forward to a pool by url (original or rewritted url ?)

If "urlorigin/asse/1/"  -->  forward to "Pool_asse1"

If "urlorigin/asse/2/"  -->  forward to "Pool_asse2"

If "urlorigin/tfon/1/"  -->  forward to "Pool_tfon1"

 

  • Send the "server name" SNI parameter to good pool_member 

I have created SSL server profile per url/pool and I specified the "server name" parameter: (it's the same certificate and profile client for all):

Profile_SSL_Server_Asse1 (server name = urldest-asse1.hppaas.com)

Profile_SSL_Server_Asse2 (server name = urldest-asse2.hppaas.com)

Profile_SSL_Server_Tfon1 (server name = urldest-tfon1.hppaas.com)

 

If "urlorigin/asse/1/" (or "urldest-asse1.hppaas.com/",  I dont know)  --> Profile_SSL_Server_Asse1

 

 

I tried to write an Irule but is KO ... (same issue with an rewrite_profile / policy to forward on pool / irule for SNI)

It's running with just one Url and with rewrite_profile, static pool on VS and SSL_Server_Profile with the "serve_name" parameter.

 

Can you help me please ?
Thanks !

  • ckteur's avatar
    ckteur
    Feb 02, 2024

    Finally, I have combined a rewrite profile, an iRule (for SSL Profile server) and a Policy (for Pool forward) ... because an other case is running with this configuration (the difference is there is not URI in source URL, just the Host).

    The screenshots are attached.

    I have adapted the need with URI parameter but it doesn't work ....

  • It sounds like you're mostly there. Can you post the iRule you're having trouble with, and any error message that you saw in /var/log/ltm while trying it out?

    • ckteur's avatar
      ckteur
      Icon for Cirrus rankCirrus

      Finally, I have combined a rewrite profile, an iRule (for SSL Profile server) and a Policy (for Pool forward) ... because an other case is running with this configuration (the difference is there is not URI in source URL, just the Host).

      The screenshots are attached.

      I have adapted the need with URI parameter but it doesn't work ....

  • Great is running !
    it was just an error in iRule where I specified "equals"  instead of "contains" and i had used the generic character "*" at the end of the URI, then I deleted it (the attached iRule is fine because have the correction)

    Thank you