Forum Discussion
http response uri rewrite based on server IP
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 should look like this - if response is www.host.com/temp/temp1 then it should became www.host.com/a1/temp/temp1.
I do not have F5 for testing purposes and I don`t have much experience with irules..
I think that this irule should look like this, please correct if I am wrong.
Thanks in advice
when HTTP_RESPONSE {
if {(([IP::addr [IP::client_addr] equals 10.10.10.1]) and !([HTTP::uri] starts_with "/a1") } {
HTTP::respond "[HTTP::header]/a1[HTTP::uri]"
}
}
- hooleylistCirrostratusHi Vytautas,
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]" } }
- Vytautas_klior1NimbostratusAaron - thanks for reply.
- hooleylistCirrostratusDo you need to send some requests to the old server and some to the new? If so what is the logic you need to use to separate the requests?
- Vytautas_klior1NimbostratusWell, NEW server has to authenticate users, but database is not moved from OLD server yet. Programmers will move one user by one from OLD server to NEW but meanwhile all connection to www.host.com must be forwarded to NEW server (F5 match host and sends to pool “NEW server” ), if server cannot find right user in its database then NEW server responds to user with redirect to www.host.com/a1, and this requests on F5 is matched by URI “/a1” and sent to pool “OLD server “ where user database is full and then users are working with OLD server.
Recent Discussions
Related Content
* 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