Forum Discussion

Rick_16795's avatar
Rick_16795
Historic F5 Account
Jul 27, 2007

redirect rewrites

Hello,

 

 

I'm working with a customer who's app requires the use of redirect rewrites in the hppt profile. However

 

the last step of their application sends a redirect that points the customer to a server on a different network and this redirect is being rewritten to use https.

 

 

We were thinking a rule such as this may work to turn off the redirect rewrite just on the one

 

URI.

 

 

when HTTP_REQUEST {

 

if ( [HTTP::uri] starts_with “/f.q.n.d/path/page.htm” ) {

 

 

redirect rewrite none

 

 

}

 

 

}

 

 

Does this sound dooable? If not, how would we go about making this happen using an irule?

 

  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Actually you can set the value for Rewrite Redirects in the http profile to "Matching" instead of "All", then LTM will only rewrite redirects referencing the hostname originally requested.
  • Rick_16795's avatar
    Rick_16795
    Historic F5 Account
    Thanks Deb, you rock...

     

     

    However it didn't work, there's another server involved that takes care of the authentication which posts

     

    to the servers behind the F5 which seems to require the rewrite redirects to be set to all in order to work.

     

     

    When set to matching authentication fails, when set to all everything works except the logout page which post

     

    out to the servers at the other campus.

     

     

    Will the iRule I originally sent up work? Or is something that cannot be done with an irule?
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    You might be able to swap http profiles for just that one request, but I've never done that so I'm not sure...

    I do know for sure that you can selectively re-write server-generated redirects with an iRule.

    I would turn off Rewrite Redirects and use an iRule like this to rewrite all but the one to HTTPS:
    
    when HTTP_RESPONSE {
      if { [HTTP::status] starts_with "3"}{
        if {[string tolower [HTTP::header Location]] != "http://host/logout.html"}{
          HTTP::header replace Location [string map -nocase {http:// https://} [HTTP::header Location]]
        }
      }
    }

    /deb