Forum Discussion
Vytautas_klior1
Mar 29, 2012Nimbostratus
http response uri rewrite based on server IP
hi folks, I need to insert string (f.e. "/a1") on http response uri from specific server IP. For example if http response comes from server ip 10.10.10.1 then insert "/a1" in URI. It shoul...
hooleylist
Mar 29, 2012Cirrostratus
Hi Vytautas,
That looks close. HTTP::header returns the value of a supplied header name. I think you want to insert the host value. Or you could leave out the protocol and host and just redirect to a local URI. Also, you have an extra open parenthesis.
when HTTP_REQUEST {
if { ([IP::addr [IP::client_addr] equals 10.10.10.1]) and !([HTTP::uri] starts_with "/a1") } {
Absolute URL redirect to http:// with the originally requested host
HTTP::respond "http://[HTTP::host]/a1[HTTP::uri]"
Local URI redirect to http:// with the originally requested host
HTTP::respond "/a1[HTTP::uri]"
}
}
Aaron
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