Forum Discussion

SanjayP's avatar
SanjayP
Icon for Nacreous rankNacreous
Sep 13, 2013

HTTP::redirect iRule

We are using redirect command in HTTP request event to redirect to another VS if specific string is there in URI.When request land on VS1, it should redirect to VS2 and should come up the page once SSO authentication is successful.

But getting SSO failing error. However, when try to launch same page using VS2 (i.e without redirection) it works fine. Redirection is working fine from VS1 to VS2.only diff I'm seeing is when we use VS2 directly I'm able to see 302 HTTP response from server. Also, tried using HTTP::respond 301 or 302 instead of HTTP::redirect in Irule, still no luck. Below is the iRule we are using for redirection.

What else needs to be checked?? when HTTP_REQUEST {

     if { [string tolower $uri] contains "/cat"} 
    HTTP::redirect "https://$static::http_throttle_catURL$uri"

}

2 Replies

  • So you're saying that SSO is failing if you get redirected to VS2, but works if you go directly to VS2, correct?

     

    If so, can you describe the SSO process a little more?

     

  • in working scenario, client is sending 1st request as POST, and server sending 302 response. And subsequent requests are GET with 304 (not modified) response from server. However, in non working scenario client is sending 1st request as GET and getting 200 ok response from server and 304 subsequent requests

     

    There was actually a good thread related to this idea a few days back:

     

    https://devcentral.f5.com/questions/url-redirect-looses-post-data

     

    The 307 status code is intended to preserve the client request, so you're iRule slightly modified might look like this:

     

    when HTTP_REQUEST {
        if { [string tolower $uri] contains "/cat" } {
            HTTP::respond 307 Location "https://$static::http_throttle_catURL$uri"
        }
    }