URL/URI rewrite without changing in Client browser
Hello All Experts,
Greetings!
I have an issue where I need to rewrite URL and as well as URIs from https://abc.com/xyz to https://pqr.com/mnp.
I found two ways to do that one I can use a profile first to match the URL and /path or URIs placed on in a data group list under iRule.
Other way looks like something following what I found in different DevCentral technical forum discussion.
if {[string tolower [HTTP::Host]] starts_with "www.abc.com" && [HTTP::path] eq "/"} { HTTP::header replace Host "partner.abc.com" HTTP::uri "/xyz" }
Now my problem is there are around 1200 URIs or paths which need to be translated from one One URL+URI to another URL+URI where the catch is URL+URI must not change in user's browser.
What would be correct way to do it? With proflies or with iRule.
In profile I saw that there is an option where I can create a rule where it states is any URL+URI matches it can be send done with HTTP_Header_replace and then I can add one more rule with HTTP_URI_Replace.
Challenge is how to match all those 1200 URL(where URL is constant) + URi(which is changing) from (example https://abc.com/xyz to https://pqr.com/mnp, https://abc.com/xyz1 to https://pqr.com/mnp1 ...and the list grows)
Also to add one more point https://abc.com is on one F5 and https://pqr.com is on another F5.
Thanks,
Prasenjit
I'd maybe argue that partitions aren't create separate logical BIG-IPs. It's more about building separate administrative domains on a single BIG-IP. Further, partitions can always access the /Common partition. To answer your question though, it depends on the level of isolation, but you should simply be able to point to the VIP in the oter partition,
virtual "/abc-app-dev/np-api-vip" or virtual "/Common/abc-app-dev/np-api-vip"
You don't need SNAT to communicate between VIPs on the same BIG-IP.
Hi Kevin,
Thanks for your guidance. Here is what I figured out and it is working now. All happened due to your idea so thanks again.
IRule for same routing domain :-
when HTTP_REQUEST {
log local0. "Incoming request: [HTTP::host]:[HTTP::uri]"
if { [set match [class match -value -- "[HTTP::host]:[HTTP::uri]" starts_with datagroup_Name]] ne "" } {
log local0. "Datagroup match: $match"
## Get first URI path in client request
set FIRSTPATH [getfield [HTTP::path] "/" 2]
## Split match into host and path
set matchlist [split $match ":"]
set MATCHHOST [lindex $matchlist 0]
set MATCHPATH [lindex $matchlist 1]
## Replace FIRSTPATH with MATCHPATH (from full HTTP::uri)
set UPDATEDPATH [string map [list "/$FIRSTPATH" "$MATCHPATH"] [HTTP::uri]]
log local0. "Updated host: $MATCHHOST"
log local0. "Updated path: $UPDATEDPATH"
HTTP::host $MATCHHOST
HTTP::uri $UPDATEDPATH
virtual "/path/virtual_server_name"
}
}For different route domain
when HTTP_REQUEST {
log local0. "Incoming request: [HTTP::host]:[HTTP::uri]"
if { [set match [class match -value -- "[HTTP::host]:[HTTP::uri]" starts_with datagroup_name]] ne "" } {
log local0. "Datagroup match: $match"
## Get first URI path in client request
set FIRSTPATH [getfield [HTTP::path] "/" 2]
## Split match into host and path
set matchlist [split $match ":"]
set MATCHHOST [lindex $matchlist 0]
set MATCHPATH [lindex $matchlist 1]
## Replace FIRSTPATH with MATCHPATH (from full HTTP::uri)
set UPDATEDPATH [string map [list "/$FIRSTPATH" "$MATCHPATH"] [HTTP::uri]]
log local0. "Updated host: $MATCHHOST"
log local0. "Updated path: $UPDATEDPATH"
HTTP::host $MATCHHOST
HTTP::uri $UPDATEDPATH
pool pool_name
}
}