Application Delivery (ADX)

Using CSW to redirect request to a different URL/domain

by on ‎05-09-2009 10:14 AM (783 Views)

Summary


We want to redirect incoming traffic with a specific URL to a different domain.

This feature will typically be needed by websites who have spinned off some  of their content to another domain.

For example, support section of Company has been moved to a new location and we want to redirect any incoming  request to the new location

Specifics

We will need Layer 7 switching in this case because we will use a match condition by matching anything starting with "/support" in the URL.

The redirect action takes three arguments:

1. the new domain-name

2. the new URL

3. the new protocol/port

We will modify the domain name to  "support.company.com", and the URL to "/". We will leave the protocol/port  number as it is.

The following is a sample packet trace after applying the configuration.

Incoming request:

GET /support HTTP/1.1\r\n

Host: www.company.com\r\n

User-Agent: ELinks/0.9.2 (textmode; Linux; 90x30)\r\n

Accept: */*\r\n

Accept-Encoding: bzip2, gzip\r\n

Accept-Language: en\r\n

Connection: Keep-Alive\r\n

\r\n

Redirect which is getting send to the client:

HTTP/1.1 302 Moved Temporarily\r\n

ServerSmiley FrustratederverIron/9.1\r\n

Connection: close\r\n

Content-Length: 0\r\n

Location: http://support.company.com/\r\n

\r\n


Topology Diagram

not needed

Sample Code/Configuration

csw-rule "r1" url prefix "/support"
!
csw-policy "p1"
match "r1" redirect "support.company.com" "/"

!
server real rs18 10.45.4.18
port http
port http url "HEAD /"
!
server virtual vip1 10.45.4.245
port http
port http csw-policy "p1"
port http csw
bind http rs18 http
!

The IP address 10.45.4.245 is the IP behind www.company.com.

Comments
by l.bailey
on ‎02-19-2010 01:07 AM

ok.... but what if you still want the user to see http://www.company.com/support/ in their browser's url bar?