Forum Discussion

Aj_2549's avatar
Aj_2549
Icon for Nimbostratus rankNimbostratus
Aug 06, 2009

Redirect rewrite Help.

Under profile TAB I do see redirect reqrite enabled for one VIP matching all.IF someone bypass this rewrite for specific Ip what irule so we need to configure .

 

 

Thanks

 

Ajay

1 Reply

  • Hi Ajay,

    You can determine whether rewrite redirects is enabled on a specific HTTP profile using PROFILE::http redirect_rewrite (Click here), but you cannot modify the configuration using this command. I think you would need to manually implement the rewriting of redirects using an iRule and then not do it for specific IP addresses. There is a Codeshare example from Deb which you could modify to do this:

    Rewrite HTTP Redirect Hostname

    http://devcentral.f5.com/wiki/default.aspx/iRules/RewriteHTTPRedirectHostname.html

    You'd want to change "myold.hostname.com mynew.hostname.com" to "http:// https://" and then add a check of the client IP address using IP::addr (Click here) or matchclass (Click here) in HTTP_RESPONSE:

     
      when HTTP_RESPONSE { 
      
         Check if server response is a redirect and client IP is not 1.1.1.1 
        if { [HTTP::header is_redirect] and not ([IP::addr [IP::client_addr] equals 1.1.1.1])} { 
      
            Log original and updated values 
           log local0. "Original Location header value: [HTTP::header value Location],\ 
              updated: [string map -nocase {http:// https://} [HTTP::header value Location]]" 
      
            Do the update, replacing "http://" with "https://" 
           HTTP::header replace Location [string map -nocase "http:// https://" [HTTP::header value Location]] 
        } 
     } 
     

    Aaron