Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Help with irule

gopalp
Nimbostratus
Nimbostratus

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 !

7 REPLIES 7

CA_Valli
MVP
MVP

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"
  }
}

 

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

 

CA_Valli_2-1665505497976.png

Exactly !! That is what the current setup is oldurl.com is already existing and products.newurl.com is an alias for same ip. So what do you suggest in order to make this working? Thank you 

I would expect this to work, as per my last tests it is in my lab. Does the VS have http and (eventually) ssl profiles applied? This script requires them to parse traffic correctly.   

gopalp
Nimbostratus
Nimbostratus

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

 

@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.