cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
988
Views
0
Helpful
4
Replies

Need help - ACE Redirection/Rewrite

daviddiazp
Level 1
Level 1

Hi guys, I've seen the examples in previous posts and some others online including the cisco documentation.

I find my scenario a bit different though and have not been able to implement a redirect that works for me.

In DNS i have domainx.com pointing to my server's VIP (A record), and www.domainx.com pointing to a CDN (CNAME record) which returns traffic to my VIP. (because of DNS RFC 1033 I cannot point domainx.com to my CDN which would be ideal).

Either way, I'm trying to make the ACE do a redirect based on the host header in the HTTP request. If the host in the request is the naked domain, then redirect to CDN, if not, just continue to the VIP.

I tried doing:

action-list type modify http cdn_rewrite

header rewrite request Host header-value domainx.com replace www.domainx.com

policy-map type loadbalance first-match LBP_X

  class class-default

    serverfarm SF_X

    action cdn_rewrite

but it doesn't do anything, I see no changes on the client side; i still see domainx.com in the URL and on the headers through Firebug.

I'm afraid a webserver-host redirect will create a loop (as the redirect target -the CDN- will bounce traffic back to me)

What's the best way and/or solution to go around this scenario?

Thanks!

1 Accepted Solution

Accepted Solutions

Hi David,

This should do the trick:

rserver redirect CNAME

  webhost-redirection http://www.web.com/%p

  inservice

serverfarm redirect CNAME

  rserver CNAME

    inservice

class-map type http loadbalance match-any Naked

  2 match http header Host header-value web.com

class-map type http loadbalance match-any WWW

  2 match http header Host header-value www.web.com

policy-map type loadbalance first-match LBP_WEB

  class Naked

    serverfarm CNAME

  class WWW

    serverfarm SF_WEB

HTH

__ __

Pablo

View solution in original post

4 Replies 4

pablo.nxh
Level 3
Level 3

Hi David,

What you're trying to do here can be achieved using HTTP redirects (301/302); redirection loops should not be a

problem as the ACE works in first-match fashion so if the matches are properly placed within the policy; this shouldn't be an issue.

Can you attach a sanitized copy of your configuration so I can reply with a sample of what needs to be done.

Tnx

__ __

Pablo

Hi Pablo, thanks for the reply.

Here's the relevant config i have in place at the moment

parameter-map type http PER_REBALANCE

  persistence-rebalance

action-list type modify http CDN_web_rewrite

  header insert both Host header-value "www.web.com"

  header rewrite both Host header-value "web.com" replace "www.web.com"

rserver host WEBSERVER1

  ip address 10.49.51.3

  inservice

rserver host WEBSERVER2

  ip address 10.49.51.5

  inservice

rserver host WEBSERVER3

  ip address 10.49.51.7

  inservice

rserver host WEBSERVER4

  ip address 10.49.51.9

  inservice

rserver host WEBSERVER5

  ip address 10.49.51.11

rserver host WEBSERVER6

  ip address 10.49.51.35

rserver host WEBSERVER7

  ip address 10.49.51.37

serverfarm host SF_WEB

  predictor leastconns

  probe ICMP

  rserver WEBSERVER1

    inservice

  rserver WEBSERVER2

    inservice

  rserver WEBSERVER3

    inservice

  rserver WEBSERVER4

    inservice

  rserver WEBSERVER5

class-map match-all VIP_WEB

  2 match virtual-address 1.1.1.1 tcp eq www

policy-map type loadbalance first-match LBP_WEB

  class class-default

    serverfarm SF_WEB

    action CDN_web_rewrite


policy-map multi-match VIPS

  class VIP_WEB

    loadbalance vip inservice

    loadbalance policy LBP_WEB

    loadbalance vip icmp-reply active

    nat dynamic 1 vlan 100

Hi David,

This should do the trick:

rserver redirect CNAME

  webhost-redirection http://www.web.com/%p

  inservice

serverfarm redirect CNAME

  rserver CNAME

    inservice

class-map type http loadbalance match-any Naked

  2 match http header Host header-value web.com

class-map type http loadbalance match-any WWW

  2 match http header Host header-value www.web.com

policy-map type loadbalance first-match LBP_WEB

  class Naked

    serverfarm CNAME

  class WWW

    serverfarm SF_WEB

HTH

__ __

Pablo

You sir are a life saver. It works perfectly, traffic gets re-routed to my CDN.

Thanks!

Review Cisco Networking for a $25 gift card