Forum Discussion

Steve_Hellams_1's avatar
Steve_Hellams_1
Icon for Nimbostratus rankNimbostratus
Jun 23, 2006

Trying to Redirect Outside URI to INSIDE URI

Please Help!

 

 

I am trying to re-direct a URI to a different URI on the inside Host

 

 

Inside host: 1.2.3.4 on Port 7800

 

with a URI of /SEH/SEHPROXY

 

 

Outside Request:

 

 

HTTP://SEHTEST.SEH.COM/SEH/DIR1/DIR2/DIR3/SCRIPT_do.prx

 

 

must be mapped to URI of /SEH/SEHPROXY on the inside host using the pool

 

 

 

Here is my script that is not working:

 

 

when HTTP_REQUEST {

 

if {[HTTP::uri] contains "/SEH"}{

 

HTTP::uri "/SEH/SEHPROXY"

 

POOL INSIDEHOST1

 

}

 

}

 

 

I tried the following change and that did not work: (HTTP::uri "/SEH/SEHPROXY")

 

 

If I use the following URL and take out the HTTP::uri statement,

 

it works, but that is not the answer:

 

 

HTTP://SEHTEST.SEH.COM/SEH/SEHPROXY/DIR1/DIR2/DIR3/SCRIPT_do.prx

 

 

I need it to work without the SEHPROXY directory being in the URI because

 

that is the path of multiple applications behind that directory on the inside

 

hosts.

 

 

PLEASE PLEASE HELP!! Thanks!

 

 

2 Replies

  • Hi,

    Here is a related post for URI mapping:

    Click here

    You can use string map to replace one string with another in the URI, in this format:

    
     set URI, replacing all instances of 'original' with 'replacement'
    HTTP::uri [string map { original replacement } [HTTP::uri]]

    Aaron
  • Hi Steve,

    If you are simply trying to substitute /SEH with /SEH/SEHPROXY, you might consider this

    
     If the URI starts with the the string /SEH
    if {[HTTP::uri] starts_with "/SEH"}{
           strip off the first 5 characters, then replace with /SEH/SEHPROXY/
          set workingUri [substr [HTTP::uri] 5]
          HTTP::uri "/SEH/SEHPROXY/$workingUri"
          pool INSIDEHOST1
    }

    Also, please note that I used "starts_with" instead of "contains" to avoid unintented side-effects.