Forum Discussion

Naumin_Dave_144's avatar
Naumin_Dave_144
Icon for Nimbostratus rankNimbostratus
Dec 22, 2016

How to hide URI from server response

Hi All,

I am trying to remove URI from return traffic(i.e. from server side response to client side) as the web server(pool member) is coded with redirection. Based on my research we need HTTP+STREAM Profile.

Basically, i want to remove uri part from server response. your suggestions required. Thanks in advance .

Example:

Client request: xyz.symantec.com

Server Response: xyz.symantec.com/cfcc/login.jsp

Trying to achieve: remove URI part from server response(i.e. /cfcc/login.jsp) & send client only host part: xyz.symantec.com

Irule Example:

when HTTP_REQUEST {

   STREAM::disable

   HTTP::header remove "Accept-Encoding"
}
when HTTP_RESPONSE {


   if {[HTTP::header value Content-Type] contains "text"}{


      STREAM::expression {@https:// xyz.symantec.com/cfcc/login.jsp@https:// xyz.symantec.com @}


      STREAM::enable
   }
}

2 Replies

  • also tried below Irule but it is getting looped(i.e. browser is keep requesting without endless time)

    when HTTP_RESPONSE { 
    
         Check if response is a redirect 
        if { [HTTP::is_redirect]} { 
    
            Check if response contains the old domain name 
           if { [HTTP::header location] contains "/cfcc/login/login.jsp" } { 
    
               Replace the old domain name with the new one in the Location header 
              HTTP::header replace location [string map {/cfcc/login/login.jsp /} [HTTP::header location]] 
    }
    } 
    }
    
  • Add logs so that you can see what is happening.

    Am I correct that you want to rewrite redirects to change the location header?

    The second iRule is the one that I would use for that - I have created one very close to that recently and it worked fine. Try this:

    when HTTP_RESPONSE { 
    
      if { [HTTP::is_redirect] && [HTTP::header Location] contains "/cfcc/login/login.jsp" } { 
        log local0. "Client [IP::client_addr] Rewriting from [HTTP::header Location]"
        HTTP::header replace Location [string map -nocase "/cfcc/login/login.jsp /" [HTTP::header Location]] 
        log local0. "Client [IP::client_addr] Rewritten to [HTTP::header Location]"
      }
    }