Forum Discussion

gopalp's avatar
gopalp
Icon for Nimbostratus rankNimbostratus
Oct 11, 2022

Help with irule

Hi,

Iam looking for help on irule setup for one of our application.athe requirement is to create an irule which renders contents of existing url with new domain.So basically we have an existing url www.oldurl.com and when i click "products" in that page it will display list list of available products.The requirement is to setup a new url "www.products.newurl.com" which should render page of "www.oldurl.com/products".We are not looking for redirection but the page should render content of oldurl/products.Any help with irule is pretty much appreciated as we are stuck with this quite sometime.Thank you !

  • Hello, try this out 

     

    when HTTP_REQUEST {
      if {[string tolower [HTTP::host]] eq "www.products.newurl.com" }{
        HTTP::header replace Host "www.oldurl.com"
        HTTP::uri "/products"
      }
    }

     

    • gopalp's avatar
      gopalp
      Icon for Nimbostratus rankNimbostratus

      Hi, Thanks for the update.I implemented the irule but getting blank page without page details.It is not displaying anything except plain white page.

      • Hello, this code rewrites client request parameters before sending the traffic to the real server. 

        I'm assuming that there already was a configuration deployed for oldurl.com which was working, and that products.newurl.com would be an alias that resolves to same VS IP -- please confirm. 

        If this is the case, you should see client requesting products.newurl.com , and request being rewritten before F5 sends it to real server in order to retrieve the desired content in a "transparent way" for client

         

  • gopalp's avatar
    gopalp
    Icon for Nimbostratus rankNimbostratus

    Hi,

    Yeah, we do have the profiles attached to the V-server and also certs configured.I will try creating a new certs and attach to the v-server as the current certs are have hostname as SAN.Thank you

     

    • Paulius's avatar
      Paulius
      Icon for MVP rankMVP

      gopalpif what CA_Valli has provided is not working then most likely your server is not configured to respond to queries for www.products.newurl.com properly. You might consider verifying that the server is configured to process the HTTP request properly for the HTTP host and HTTP uri properly.