Forum Discussion

Gladney_7700's avatar
Gladney_7700
Historic F5 Account
Jun 13, 2012

Disable HTTP_RESPONSE if a specific uri is requested

Hi All,

 

 

I am trying to create an exception to a stream rule on HTTP_RESPONSE if the request comes in to a specific URI.

 

 

 

My current iRule is:

 

when HTTP_RESPONSE {

 

 

Check if response type is text

 

if { [HTTP::uri] equals "/otcs/llisapi.dll?func=ngd.ucroot"}

 

STREAM::disable

 

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

 

 

Replace http:// with https://

 

STREAM::expression {@http://rambusdocsdev.rambus.com@https://rambusdocsdev.rambus.com@}

 

Enable the stream filter for this response only

 

STREAM::enable

 

}

 

 

Check if server response is a redirect

 

if { [HTTP::header is_redirect]} {

 

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]]

 

}

 

}

 

 

 

 

I want to add This,

 

 

 

when HTTP_REQUEST {

 

if { [HTTP::uri] equals "/otcs/llisapi.dll?func=ngd.ucroot"} {Some command to stop processing

 

 

}

 

 

 

I've tried using the event command, but I can't seem to get the syntax correct.

 

 

 

Thanks,

 

 

 

Gladney

 

2 Replies

  • Hi Gladney,

     

     

    Can you clarify what you're trying to do? Do you want to have users access https://rambusdocsdev.rambus.com but proxy the requests to http://rambusdocsdev.rambus.com and rewrite http://rambusdocsdev.rambus.com to https://rambusdocsdev.rambus.com in response headers and content?

     

     

    What do you want to happen if the URI is /otcs/llisapi.dll?func=ngd.ucroot? Not write http:// to https:// in responses?

     

     

    Aaron
  • Gladney_7700's avatar
    Gladney_7700
    Historic F5 Account
    Hi Aaron,

     

     

    Right now the stream replace on the response is working. We want to make sure that if the site has links or redirects, that users only get https destinations. However, we need to disable the response stream for one particular URI /otcs/llisapi.dll?func=ngd.ucroot?

     

     

    Thanks,

     

     

    Gladney