Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

Webhost-redirection and http rewrite?

I have a customer that has an URL, for example that points to different tomcat instances using other url’s, therefor I have used webhost-redirect, this works fine. But, the customer want this redirect not to be visible for the user, how is this possible? I was thinking that an action-list with http insert/rewrite would fix it, but still I haven’t got this to work. First, is it possible to do this? Second, does anyone have a good configuration example for this?


Re: Webhost-redirection and http rewrite?


It is not clear to me from your description what you are trying to accomplish.  Can you please elaborate on what your requirements are?



New Member

Re: Webhost-redirection and http rewrite?

OK, I will try to be clear.

The customer make’s a call for the URL http://enoviaprod or someone of the 2 others listed in the left.  This call will be redirected to different hosts using another URL via the webhost-redirect command, see the right URL’s. This works pretty good. The customer wants this redirect to be invisible for the users, meaning that the called URL should be the one visible for the user after the redirect. Can this be done using the http rewrite command?

http://enoviaprod                                          http://sefags154:7001/ematrix, http://sefags155:7001/ematrix, http://sefags154:7002/ematrix, http://sefags155:7002/ematrix

http://enoviaprod/ematrix                            http://sefags154:7001/ematrix, http://sefags155:7001/ematrix, http://sefags154:7002/ematrix,

http://enoviaprod/WebContent                           http://sefags154:7007/WebContent, http://sefags155:7007/WebContent



Re: Webhost-redirection and http rewrite?


I'm not sure if you can do this.  It looks to me, and correct me if I'm wrong, like you are load balancing a request to to any one of the URLs on the right.  If this is the case you'd need to be able to rewrite the Host header based on the rserver that is chosen in the load balancing algorithm.  The problem with that is that the Host header rewrite is per serverfarm, not per rserver.

You can rewrite the Host header as follows:

serverfarm host REALS
  probe tcp
  rserver SERVER 7001

action-list type modify http ENOVIAPROD-to-SEFAG
  header rewrite request Host header-value "enoviaprod\.com" replace "sefags154:7001"

class-map type http loadbalance match-all ENOVIAPROD
  2 match http header Host header-value ""

class-map match-any HTTP-DOT-203
  2 match virtual-address tcp eq www

policy-map type loadbalance first-match PM-HTTP-DOT-203
    serverfarm REALS
    action ENOVIAPROD-to-SEFAG
  class class-default
    serverfarm REALS

If you don't need the :7001 after the sfags Host header, then you could to the action-list as follows:

action-list type modify http ENOVIAPROD-to-SEFAG
   header rewrite request Host header-value "enoviaprod\.com" replace "sefags154"

However, the above configuration will always rewrite the header in the same way, regardless of which rserver it goes to.  I'm not sure if this helps or not.