For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

F5Hopper_28651's avatar
F5Hopper_28651
Icon for Nimbostratus rankNimbostratus
Jul 25, 2016

wildcard URL redirection with wildcard as part of URL

Not sure how to do this, its a PURL project.

 

Original PURL: firstname-lastname.www.somesite.com

 

Re-direct address: www.somesite.com/personal-landing/index.asp?cust=firstname-lastname

 

no idea where to start.

 

Code
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host][HTTP::path]] {
    "[HTTP::?].www.somesite.com"  {
 HTTP::redirect "http://www.somesite.com/personal-landing/index.asp?cust=[HTTP::?]"
    }
}

}

 

4 Replies

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    Try this one:

    when HTTP_REQUEST {
        HTTP::redirect "http://www.somesite.com/personal-landing/index.asp?cust=[string tolower [lindex [split [HTTP::host] "."] 0]]"
    }
    

    .

  • I found my answer. now any DEV server with DEV01 or DEV99 will change on request.

    when HTTP_REQUEST {
        set HOST [string tolower [HTTP::host]]
        set USER [getfield $HOST "." 1]
        set DEV [getfield $HOST "." 2]
        set SITE [getfield $HOST "." 3]
        HTTP::redirect "http://$DEV.www.somesite.com/personal-landing/index.asp?cust=$USER"
        }
    
    • F5Hopper_28651's avatar
      F5Hopper_28651
      Icon for Nimbostratus rankNimbostratus

      ok I removed one line(set SITE [getfield $HOST "." 3]) now it all worked 100% in chrome and Safari..I guess since it was not being used it was a problem...

      when HTTP_REQUEST {
      set HOST [string tolower [HTTP::host]]
      set USER [getfield $HOST "." 1]
      set DEV [getfield $HOST "." 2]
      HTTP::redirect "http://$DEV.www.somesite.com/personal-landing/index.asp?cust=$USER"
      }