Forum Discussion

Carl_Gottlieb_1's avatar
Carl_Gottlieb_1
Icon for Nimbostratus rankNimbostratus
Apr 16, 2007

Modify HTTP resonse redirect

Hi,

 

 

I have a webserver generating a 302 redirect to the client, sending them to a location of:

 

 

https://www.domain.com/uristuffhere&URI=http://www.domain.com&somemorestuff&URI=http=http://www.domain.com

 

 

I need to modify this response to change the strings in the Location to be https if they are not already. In effect, an iRule to find the string of URI=, look at the next 5 characters, if they are http: change them to https:

 

I'd like this function to apply to both instances of the URI= in the HTTP response Location header.

 

 

Out of interest, I need this iRule to workaround an issue with a GetAccess server behind an SSL terminating BigIP version 9.2.4. The requests to the GetAccess server are in HTTPS but the redirects it generates contain http references in the Location as described above.

 

 

Could anyone point me in the right direction to accomplish this?

 

 

Many thanks,

 

 

Carl

2 Replies

  • Hi Joe,

     

     

    Many thanks for this. It didn't work for some reason until I added the replace option, i.e.:

     

     

    when HTTP_RESPONSE { if { [HTTP::status] eq 302 } { HTTP::header replace "Location" [string map {"http://" "https://"} [HTTP::header "Location"]] } }

     

     

     

    It now works perfectly.

     

     

    Thanks again.

     

    Carl