Forum Discussion
SathishF5Dasam
Nimbostratus
Jun 04, 2016Apache 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 https://www.abcd.com/123/ then that becomes
‘https://www.abcd.com/123/?remote-addr=10.10.10.5®ex10.10.10.5’ only for the query it must match
Rule in Apache:
RewriteRule ^(/123/.+)$ $1\?remote-addr=%{REMOTE_ADDR}\®ex=%{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 "www.abcd.com" and [HTTP::path] eq "/132/" } { if { [HTTP::query] eq "" } { HTTP::query "remote-addr=$client_ip®ex=$client_ip" } else { HTTP::query "[HTTP::query]&remote-addr=$client_ip®ex=$client_ip" } } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects