Forum Discussion

David_Tumlin's avatar
David_Tumlin
Icon for Nimbostratus rankNimbostratus
Jun 02, 2010

Problem with Proxy Pass iRule

I am deploying a pair of LTMs to use as a reverse proxy in front of a SAP NetWeaver portal. I will probably be using the ProxyPass iRule to rewrite internal server addresses to Visrtual Server addresses. The problem I have is that some of the URLs within the pages are not being rewritten (or, according to debug on the ProxyPass rule, even seen.) I have done tcpdumps from the LTM and the client and can clearly see the URL in the HTTP content. I have the generic Stream profile assigned to the VS. Any ideas?

 

9 Replies

  • Hi David,

     

    Can you please post your iRuleand provide this post the debugs along with the contents of the STREAM profile. This will certainly help the iRule community look at your code and see if there is any misstep and provide some advise or direction.

     

     

    Thanks,

     

    Bhattman
  • Hi David,

     

    There is a v10 of the ProxyPass for 10.x builds

     

     

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

     

     

    This might set you back on the right path

     

     

    Bhattman
  • It looks like no matching rules are found as the client is requesting the VS on port 80, but you have the datagroup set for a source of testvip..net:8020. Are you trying to only remove the :8020 port from the server's response headers and/or content?

     

     

    Aaron
  • I was playing with the ProxyPass rule initially because of the debug capabilities. A stripped down rule to perform what I am attempting is below. I am trying to modify the hostnames in URLs.

     

     

     

    when HTTP_RESPONSE {

     

     

    if { [HTTP::header exists "Accept-Encoding"] } {

     

    HTTP::header remove "Accept-Encoding"

     

    log local0. "$log_prefix: Removed Accept-Encoding header"

     

    Disable the stream filter by default

     

    STREAM::disable

     

     

    Check if response type is text

     

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

     

     

    Match any http:// instance and replace it with nothing

     

    STREAM::expression {@URL=http://qj1cen00.na..net:8020/@URL=http://testvip..net:8020/@}

     

     

    Enable the stream filter for this response only

     

    STREAM::enable

     

    }

     

    }

     

    }

     

    }

     

    when STREAM_MATCHED {

     

    log local0. "Stream matched [STREAM::match]"

     

    }
  • Can you remove the Accept-Encoding header from the requests? This prevents the server from sending compressed responses. And do you really want the client to make a request to the test VS on port 8020?

    
    when HTTP_REQUEST {
       if { [HTTP::header exists "Accept-Encoding"] } {
          HTTP::header remove "Accept-Encoding"
          log local0. "$log_prefix: Removed Accept-Encoding header"
       }
    }
    when HTTP_RESPONSE {
    
        Disable the stream filter by default
       STREAM::disable
    
        Check if response type is text
       if {[HTTP::header value Content-Type] contains "text"}{
    
           Set the replacement string
          STREAM::expression {@URL=http://qj1cen00\.na\.\.net:8020/@URL=http://testvip..net:8020/@}
    
           Enable the stream filter for this response only
          STREAM::enable
       }
    }
    when STREAM_MATCHED {
       log local0. "Stream matched [STREAM::match]"
    }
    

    Aaron
  • It works. It was the compression that kept the Stream profile from working.

     

     

    In the long run, I will not want to use 8020, but was working on a proof of concept.

     

     

    Thank you very much Aaron