Forum Discussion

SathishF5Dasam's avatar
Icon for Nimbostratus rankNimbostratus
Jun 04, 2016

Apache to irule (inserting IP address in HTTP request/query)

I'm trying to insert remote address for the below http uri in IRULE (no X-forward)


If i request for URL like then that becomes®ex10.10.10.5’ only for the query it must match


Rule in Apache:


RewriteRule ^(/123/.+)$ $1\?remote-addr=%{REMOTE_ADDR}\&regex=%{REMOTE_ADDR} [PT,QSA]


Appreciate irule coders!!!


1 Reply

  • Hi,

    here an example you can use :

    when HTTP_REQUEST {
        set client_ip [IP::client_addr]
        if { [HTTP::host] eq "" and [HTTP::path] eq "/132/" } {
            if { [HTTP::query] eq "" } {
                HTTP::query "remote-addr=$client_ip&regex=$client_ip"
            } else {
                HTTP::query "[HTTP::query]&remote-addr=$client_ip&regex=$client_ip"