Replace host & aliases URL

hello, We have development with the application for requirement the format, example the application url :

- mysite.com/apps/asset/post ---> it’s want like access ----> backsite.com/migration/asset/post

- mysite.com/apps/dss/front ---> it’s want like access ----> backsite.com/migration/dss/front

- mysite.com/apps/script/css---> it’s want like access ----> backsite.com/migration/script/css

we now create irules :

when HTTP_REQUEST {<br>if {[string tolower [HTTP::uri]] starts_with "/apps"} {<br>HTTP::header replace Host "backsite.com"<br>set removeContent [string map [list "/apps/" "" ] [HTTP::uri]]<br>HTTP::uri /$removeContent<br>pool Pool_backsite_apps<br>}<br>elseif {[string tolower [HTTP::uri]] starts_with "/apps2"} {<br>HTTP::header replace Host "backsite2.com"<br>set removeContent [string map [list "/apps2/" "" ] [HTTP::uri]]<br>HTTP::uri /$removeContent<br>pool Pool_backsite2_apps<br>else {<br>HTTP::header replace Host "apikey-external-apicast-production.apim-dev.apps.ocp-jkt.backsite.com"<br>}<br>}

with this irules the access using HTTP HOST : mysite.com is working to backsite.com with :

mysite.com/apps/migration/asset/post…

mysite.com/apps/migration/dss/front/…

mysite.com/apps/migration/script/css/…

what must to set irules to goals HTTP URI /apps can be aliases /migration , because /apps it differentiator for other path on the apps. we trying to create redirect /apps/migration and removeContent before i replace HTTP:host but not worked

Hi  @Rizky125  
Please check this article.

This might help you to write irule as per your use case.

Hope it helps!