Forum Discussion

Brett_10648's avatar
Brett_10648
Icon for Nimbostratus rankNimbostratus
Oct 31, 2012

Apache proxy rewrite to F5

Hi,

 

I'm tring to convert the following Apache Rewrite rule to an F5 iRul but am having no luck. I think I am am on the right track but would be grateful for any assistance.

 

This is the apache rule:

 

RewriteRule ^(.*)/lmykproxy/(.*) http://subdomain.domain.com/$2 [P,L]

 

This is the iRule I have so far..

 

when HTTP_REQUEST {

 

if {[HTTP::uri] contains "lmykproxy"} {

 

log "Requested URL is [HTTP::host][HTTP::uri]"

 

set newuri [findstr [HTTP::uri] /lmykproxy/ 11]

 

HTTP::uri "$newuri"

 

HTTP::header replace "Host" "subdomain.domain.com"

 

log "New URL is [HTTP::host][HTTP::uri]"

 

}

 

}

 

 

Thanks in advance.

 

1 Reply

  • Unfortunately I don't understand the original rewrite rule but I hope this will help;

    
    when HTTP_REQUEST {
      if { [HTTP::uri] contains "lmykproxy" } {
        log local0. "Requested URL is [HTTP::host][HTTP::uri]"
        Added local0. above
        set newuri [findstr [HTTP::uri] /lmykproxy 10]
        Modified above so the URI contains a starting "/"
        HTTP::uri $newuri
        HTTP::header replace "Host" "subdomain.domain.com"
        I'm not sure you need "" around the domain name???
        log local0. "New URL is [HTTP::host][HTTP::uri]"
        Added local0. above
      }
    }