URI inspect - Rewrite - Redirect
DevGods
I am trying to inspect URI and Insert into a newly formatted redirect. I am trying to use the URI Interrogation code to dump the params then formulate the redirect.
If I read the code correctly I should be able to dump the query into param format then I FEASIBLY should be able to write a rule that would look something like this correct?
when HTTP_REQUEST {
set namevals [split [HTTP::query] "&"]
for {set i 0} {$i < [llength $namevals]} {incr i} {
set params [split [lindex $namevals $i] "="]
set pnum [expr $i+1]
log local0. "Param[$pnum]: [lindex $params 0]"
log local0. "Value[$pnum]: [URI::query [HTTP::uri] [lindex $params 0]]"
if { [HTTP::uri] starts_with "/receiptLocator" } {
HTTP::redirect "https://my.domain.com/ReceiptLocator=$pnum1&CityOrigin=$pnum2&FirstName=$pnum3&LastName=$pnum4"
Incoming URI I will inspect
receiptLocator=ABCDEF&originCity=BOS&firstName=John&lastName=Doe&language=en
Rewritten and Redirected URI
ReceiptLocator=ABCDEF&CityOrigin=BOS&FirstName=John&LastName=Doe