Forum Discussion

  • bl0ndie_127134's avatar
    bl0ndie_127134
    Historic F5 Account
    We have been talking about adding a feature to make POST field extraction a little bit easier but for now you will have to do an HTTP::collect and use the HTTP::payload command to access and parse the data.
  • Thanks for your reply. Let me explain our existing rules and what I am trying to achieve:

     

     

    Existing rules:

     

    -------------------------

     

    when HTTP_REQUEST {

     

    if { [active_members servpool1] == 1 } {

     

    log "pool1 is up"

     

    set uri [HTTP::uri]

     

    log "the initial http uri is: $uri"

     

    if { $uri starts_with "/logon\.mic" } {

     

    set new_uri [string replace $uri 0 10 /mic/SignIn.mic]

     

    HTTP::uri "$new_uri"

     

    pool servpool1

     

    log "The replaced URL is: $new_uri"

     

    }

     

    elseif { $uri starts_with "/ea/" } {

     

    set new_uri [string range $uri 3 end]

     

    log "the new URI is: $new_uri"

     

    HTTP::uri "$new_uri"

     

    pool servpool1

     

    log "the new HTTPURI is $new_uri"

     

    }

     

    }

     

     

    This is what we want to achieve:

     

     

    1: We want to retrive a post field named "data" from the initial request from the client

     

    2: then set the new_uri variable to :

     

    set new_uri [string replace $uri 0 10 /mic/SignIn.mic?data=$data]

     

    where $data is the post field retrieved from the client request.

     

     

     

    How can we do that?

     

     

    Thanks,

     

    Kapil

     

  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    You would need to run HTTP::collect when you detect that you are dealing with the form. Then in the HTTP_REQUEST_DATA event, you need to search for the field and can then rewrite the uri to include the data. Try searching for collect and HTTP_REQUEST_DATA to see some examples of collecting HTTP payload.