Application Delivery (ADX)

Reply
New Contributor
Posts: 5
Registered: ‎02-15-2010

Redirect & rewrite?

Hello,

I have a corporate web site www.centre.ac.uk where if I try and go to /catalogue I get redirected to an internal server www.example.ac.uk/page. I have used csw rule and a policy to redirect www.centre.ac.uk/catalogue to www.example.ac.uk/page e.g.

csw-rule "rule1" url prefix "/catalogue"

csw-policy "policy"

match "rule1" redirect "www.example.ac.uk" "/page"

server virtual slb-example 192.168.84.50

port default disable

port http sticky concurrent

port http csw-policy "policy"

port http csw

bind http www-server 81 real-port http

This all works fine but I'd like to be able to rewrite the url that the user sees in their browser. Instead of seeing www.example.ac.uk/page, I'd like them to see www.centre.ac.uk/catalogue. I've read the post for 'How do you rewrite outbound URL responses?' but it would seem that I am trying to apply two different types of policy at the same time. Will it be possible to do this?

Thanks, L.


Occasional Contributor
Posts: 89
Registered: ‎03-02-2009

Re: Redirect & rewrite?

Yes, can have request and response policies under the same virtual server. Basically,add a response-rewrite-policy to your virtual. Here is some sample code that should achieve what you want.

csw-rule "rr1" response-status-code 302 302
csw-rule "rr2" response-header "Location" pattern "www.example.ac.uk/page"


csw-policy "rp1" type response-rewrite
match "rr1" response-header-rewrite
match "rr2" rewrite response-header-replace "www.centre.ac.uk/catalogue" offset 0 length 22

server virtual slb-example 192.168.84.50
port http response-rewrite-policy "rp1"

New Contributor
Posts: 5
Registered: ‎02-15-2010

Re: Redirect & rewrite?

Hi,

Many thanks for your reply.

I understand the response rewrite policy you have created but if I try and add a second policy to my virtual server I get a message telling me to unbind the existing policy (the working redirect policy).

Occasional Contributor
Posts: 89
Registered: ‎03-02-2009

Re: Redirect & rewrite?

That's strange. That is supported (for all versions) and I just did a quick test here as sanity test to add request/response policies via CLI/GUI. What version are you running. Did you get same result via GUI. All I can suggest is try it on a new virtual server from scratch to see if same issue. If no joy, contact support to see what localized issue is occuring...

New Contributor
Posts: 5
Registered: ‎02-15-2010

Re: Redirect & rewrite?

Hi,

Thanks again!

I've just noticed that I was trying to bind the policy using port http csw-policy xxx instead of port http response-rewrite-policy xxx

So I will give that a go!

New Contributor
Posts: 5
Registered: ‎02-15-2010

Re: Redirect & rewrite?

The rewrite policy is now in. My redirect policy still works but the rewrite isn't being met and actioned. When I look at rconsole, I see the redirect rule being met and actioned but then nothing more for the rewrite. I guess the first condition that would have to be met would be the status code 301 302. Wireshark shows 302 coming back from the serveriron with the url redirect. My client then goes straight to the redirect and pulls the content.  Any ideas?  Thanks, L.

Join the Community

Get quick and easy access to valuable resource designed to help you manage your Brocade Network.

vADC is now Pulse Secure
Download FREE NVMe eBook