Forum Discussion

Bob_66655's avatar
Bob_66655
Icon for Nimbostratus rankNimbostratus
Sep 20, 2018

Irule rewrite

Trying to set this for dev request.

VS has 3 names https://abc.com/ https://def.com/ https://xyz.com/

When user enters https://abc.com/* or https://def.com/* It would proxy over to https://xyz.com/test/index.html but the original web address remain in the their browser

Im trying

 when HTTP_REQUEST {
 if { [HTTP::host] contains "abc.com"} 
{ 
HTTP::header replace Host https://xyz.com
HTTP::uri "/test/index.html"}
}  
 if { [HTTP::host] contains "def.com"}
{ 
HTTP::header replace Host https://xyz.com
HTTP::uri "/test/index.html"}
}

But the browser report a 400 bad request error

3 Replies

  • That is fairly simple to do - set the correct pool member and change the Host header.

     

    But be clear that their browser will load the HTML from what it thinks is https://abc.com but it may have links to https://xyz.com embedded in the page, and if they click on a link then it may well take them to https://xyz.com/example.html instead of https://abc.com/example.html.

     

    So it probably won't do exactly what you want it to do, unless the code on https://xyz.com is well written and doesn't reference the site.

     

  • The VS has the same pool member for all 3 urls So I dont see the need to select a different pool in the VS.

     

    Also when i do it in the code above i get 400 error bad request