Forum Discussion

Aaron_Tebo_7015's avatar
Aaron_Tebo_7015
Icon for Nimbostratus rankNimbostratus
Sep 09, 2009

rewrite help

Hello,

 

 

I have the following irule to rewrite a url

 

 

when HTTP_REQUEST {

 

log local0. "[IP::client_addr]:[TCP::client_port]: Original URI: [HTTP::uri]"

 

log local0. "urlrewrite rule"

 

Check if URI matches first format using scan

 

if {[scan [HTTP::uri] {/%/app/download.php%(.*)} a] == 1}

 

{

 

HTTP::uri "http://www.myserver.com/tools/app/download/vendor/language/installer$a"

 

}

 

}

 

 

===Log===

 

 

When I hit this rule i get the following error in my logs.

 

 

TCL error: urlrewritedownload HTTP_REQUEST - bad scan conversion character p while executing scan [HTTP::uri] {/app/download.php.*} a

 

 

 

The url I use to execute the irule is

 

 

http://www.abc.com/app/download.php?id=1140000

 

 

Thanks,

 

 

Aaron

 

  • Are you trying to append id=1140000 to the following redirect http://www.myserver.com/tools/app/download/vendor/language/installer?id=1140000?

    if so then perhaps the following will work

      
     when HTTP_REQUEST {  
     log local0. "[IP::client_addr]:[TCP::client_port]: Original URI: [HTTP::uri]"  
     log local0. "Original Path: [HTTP::path]"  
     log local0. "Original Qeury: [HTTP::query]"  
     log local0. "urlrewrite rule"  
     if { ([HTTP::host] eq "www.myserver.com") and ([HTTP::path] eq "/app/download.php") } {  
     HTTP::redirect "http://[HTTP::host]/tools/app/download/vendor/language/installer?[HTTP::query]"  
     }  
     }  
     

    I hope this helps

    CB