Forum Discussion

Angelo's avatar
Angelo
Icon for Nimbostratus rankNimbostratus
Sep 13, 2012

source address in URI header

Hi

 

i need to insert the source address into the header of a website is there a way for me to do this. i think i will need to have streaming for this but not sure how to set it up...

 

  • Are you talking about the title or a block of HTML? It's relatively straight forward if there's an HTML object that you can (consistently) grab onto:
    when HTTP_REQUEST {
     disable stream processing for request traffic
    STREAM::disable
    s store the client IP address
    set client_ip [IP::client_addr]
    }
    when HTTP_RESPONSE {
    if { [HTTP::header Content-Type] equals "text/html" } {
     establish the stream expression - here we're just modifying the  contents
    STREAM::expression "@@ - ($client_ip)@" 
     enable stream processing
    STREAM::enable
    }
    }
    
    If the DOM object has a specific attribute just modify your stream expression to look for and replace that.
  • Angelo's avatar
    Angelo
    Icon for Nimbostratus rankNimbostratus
    HI Kevin

     

     

    thanks for the reply.. i need to insert the source address into the title. i'll try it... thanks for the reply
  • For some reason my code block was munged. Here's what I meant to say.

     

     

    when HTTP_REQUEST {

     

    disable stream processing for request traffic

     

    STREAM::disable

     

    s store the client IP address

     

    set client_ip [IP::client_addr]

     

    }

     

    when HTTP_RESPONSE {

     

    if { [HTTP::header Content-Type] equals "text/html" } {

     

    establish the stream expression - here we're just modifying the contents <br /> STREAM::expression "@@ - ($client_ip)@"

     

    enable stream processing

     

    STREAM::enable

     

    }

     

    }

     

     

    This replaces the end title tag with the client IP and end tag.

     

  • Ahh! it did it again...

    
    when HTTP_REQUEST {
     disable stream processing for request traffic
    STREAM::disable
    s store the client IP address
    set client_ip [IP::client_addr]
    }
    when HTTP_RESPONSE {
    if { [HTTP::header Content-Type] equals "text/html" } {
     establish the stream expression - here we're just modifying the  contents
    STREAM::expression "@@ - ($client_ip)@" 
     enable stream processing
    STREAM::enable
    }
    }