http response rewrite of url

I have a BigIP box that is loadbalancing two servers in a pool. A user will type in ecc.empireblue.com, and then is redirected to

https://smeeccweb01/Citrix/MetaFrame/default/default.aspx

or

https://smeeccweb02/Citrix/MetaFrame/default/default.aspx

What I need to be able to do is mask the server name. The app owner wants to see

https://ecc.empireblue.com/Citrix/MetaFrame/default/default.aspx

can I rewrite this response

Thanks!

You sure can! I’d recommend checking into the HTTP:header replace command.

Also, check out this post : Click here

HTH,

-Colin

Thanks for the reply!

Will this work with https?

Hey everyone, I tried this iRule

when HTTP_RESPONSE {

set newhost “eccext.empireblue.com”

if { [HTTP::header host] eq “smeeccweb01” } {

HTTP::header replace host $newhost

}

if { [HTTP::header host] eq “smeeccweb02” } {

HTTP::header replace host $newhost

}

}

Its not working. Any thoughts?

I’d throw in some logging to find out exactly what isn’t working. BTW, you can use the “HTTP::host” command to extract the current host. Also, the header is “Host” although I believe the header replace command ignores case. I’ve also made your second if and elseif so it doesn’t have to be processed if the first one succeeds.

when HTTP_RESPONSE {
  set newhost "eccext.empireblue.com"    
  log local0. "Requested Host: [HTTP::host]"
  if { [HTTP::host] eq "smeeccweb01" } {      
    log local0. "Found requested host smeeccweb01, replacing with $newhost"
    HTTP::header replace "Host" $newhost      
  } elseif { [HTTP::host] eq "smeeccweb02" } {      
    log local0. "Found requested host smeeccweb02, replacing with $newhost"
    HTTP::header replace "Host" $newhost      
  }    
}

The look in the /var/log/ltm file to see what was going on. If the messages show that the header replace command is being called, yet you don’t see the correct Host header on your backend server, then this might be an issue you need to bring up with product support because this should work.

-Joe

Hey, thanks for the info. I just realized that the client request comes into the BigIP box as an HTTP request but the reply goes back to the client as SSL! How do I do a ip header rewrite on SSL response? Is it possible?

Sorry, I am kinda new to this being a Cisco engineer.

First of all, I didn’t know that could be done. How can a browser issue a HTTP request over port 80 and then receive the response as SSL? The encryption is part of the connection negotiation.

Or do you have a custom application that handles the request/responses itself? I’m still not sure how this would work without a HTTP redirect.

With that being said, the only way to have the BIG-IP modify headers in SSL traffic is if the BIG-IP is terminating that SSL connection. Otherwise the content is just a bunch of scrambled bits to the BIG-IP.

-Joe

Hey Joe,

Thanks for the fast response. This is a client connecting to a Citrix presentation server. The citrix server does the redirect to SSL. We dont want to pass clear text credentials. I think that this is an impossible endeavor. I learned alot and want to thank all who helped me out

I am sure I will be back!

thanks

cidisbell

Would you mind posting up the iRule you’re using to accomplish what’s listed in your first statement?

I’m looking to do the same thing, but unfortunately, I don’t have a lot of experience with iRules.

Thanks