Forum Discussion

Jose_Santiago_O's avatar
Jose_Santiago_O
Icon for Nimbostratus rankNimbostratus
Apr 24, 2008

Rewriting external host

Hi,

 

I want to do this with rules: if an external client goes to http://www.externalserver.com/abc/app1, make this client go to http://internalserver1/app1 without redirecting, because http://internalserver1 is not reachable outside the company, if another client goes to http://externalserver.com/def/app1, then make this client goes to http://internalserver2/app1, also without redirecting since internalserver2 is not reachable outside the company.

 

 

I can do the uri rewriting with string range, the problem is that the browser is redirecting the host to my internal server and outside the company it wont work.

 

 

So far, i have this:

 

 

when HTTP_REQUEST {

 

if { [string tolower [HTTP::uri]] starts_with "/abc" } {

 

HTTP::header replace Host internalserver1

 

set uri [string range [HTTP::uri] 4 end]

 

HTTP::uri $uri

 

pool pool_internalserver1

 

}

 

 

}

 

 

The web server are IIS and they need to match the hostname, so i need to send them the hostname, but without redirecting the browser to my final client.

 

 

Does anyone has done this before?

 

 

Regards,

 

Jose Santiago Oyervides.

2 Replies

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    If you need to re-write the hostname for the internal server, you'll want to look at the HTTP::header replace command. You'll also want to re-write it again on the way out for the client, since you don't want the client to see the change.

     

     

    Hope that gets you headed in the right direction. If you have more questions, or need some more clarification feel free to ask.

     

     

    Colin