strange 302 error on URI inspect and Load Balance

I have a situation where I would like to take the following URL:

http://f5.site.com/lbtst2

and rewrite the back end url to be “/lbtest” but use the pool “lbtest2”.

Simple right? Should be something along the lines of:

when HTTP_REQUEST {

if { [HTTP::uri] starts_with “/lbtst2”}{

HTTP::uri “/lbtest”;

log local0. “hit /lbtst2”;

pool lbtest2;

}

}

However, when sniffing the traffic the load balancer is sending the

following:

HTTP Status: 302

HTTP Reason: Moved Temporarily ..

Location: http://f5.site.com/lbtest/ ..

This isn’t what I want to do at all. I would like just he back-end service to be changed and the client to NEVER see the request change.

As you might have guessed the client gets the new location http://f5.site.com/lbtest/ and hits the LTM using the new rule set for “/lbtest”.

Any ideas?

Hi Rob -

I would say you might not want to be so quick to attribute the redirect to the iRule, as your iRule doesn’t contain any code which would send a redirect, and it should accomplish what you describe.

I would first suspect that there is a redirect still in place on the real server.

If that’s not it, the only other thing I can think of is that you might have a fallback host specified on your virtual server, and all the default pool members are DOWN.

You might be able to verify by browsing directly to the real server & see if you get the same redirect. Otherwise, a simultaneous packet trace on the serverside and clientside vlans of LTM will reveal whether the redirect is generated by or simply propagated by LTM.

HTH

/deb

Turned out the web server was issuing the redirect since it wasn’t happy that the iRule didn’t attach a trailing slash on the URI. Just had to change the iRule from "HTTP::uri “/lbtest” to "HTTP::uri “/lbtest/”. Darn picky web servers…

Thanks!