Forum Discussion
hc_andy_35682
Nimbostratus
May 11, 2010Bypassing a VIP based on destination address
Hi All,
Our LTM is configured with a PROXY_VIP and WEBMAIL_VIP which load balances proxy and webmail traffic for schools. Schools use the PROXY_VIP to access HTTP/HTTPS web sites and the IP address of the PROXY_VIP is hard coded in the student's browser.
So if schools need access to http://webmail.com, their request first gets served by the PROXY_VIP which load balances the request to a real proxy server and then the proxy server goes and fetches the webmail page which in turn gets load balanced by the WEBMAIL_VIP.
Can the LTM do the following:
1/ If the request is from a school IP address and the destination address is http://webmail.com, can we bypass the PROXY_VIP and redirect the request to the WEBMAIL_VIP.
2/ If 1 is not possible, once the request hits the PROXY_VIP and the destination address is http://webmail.com , can we use HTTP Redirection to redirect the request to the WEBMAIL_VIP but PRESERVE the School's IP address as the source IP rather than it being the IP address of the proxy server???
The reason for doing this is so that we can maintain source address persistence like so: school IP -> webmail machine rather than proxy server IP -> webmail machine.
Thanks.
Andy
http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/afv/topic/aft/1172300/aff/5/showtab/groupforums/Default.aspx
- Hamish
Cirrocumulus
1. If the proxy ip address is hard-coded in the browser then it doesn't matter what you redirect to... It'll still go via the proxy... The only way around that really is to use a PAC file (It's a small javascript program that gets run for EVERY URL accessed. It can decide whether to use a proxy or go direct to a website). - hc_andy_35682
Nimbostratus
Thanks for the reply Hamish. - hc_andy_35682
Nimbostratus
Been playing with this, but can't figure it out... - Hamish
Cirrocumulus
OK, you're looking for either the CONNECT (If using HTTPS on webmail) or the GET/POST/whatever requests if using cleartext. YOu do something like (Completely untested, syntax may not be 100%... YMMV... ).if { ([HTTP::uri] contains "webamil.server.com") || ([HTTP::header host] equals "webmail.server.com") } { use pool webmail_pool return } use pool proxy_pool snat automap
- hc_andy_35682
Nimbostratus
Thanks for the help Hamish... I've attempted to use the irule on the Performance L4 proxy_vip (Protocol TCP/FastL4 profile) but getting the following errors.
I'm using the code below which is exactly the same as what you suggested w/o the SNAT line. To be able to use any of the "HTTP::syntax", doesn't the vip have to be of type Performance (HTTP)??? Note that this is a proxy vip which is answering on TCP Port 3128.01070151:3: Rule [test] error: line 3: [command is not valid in current event context (CLIENT_ACCEPTED)] [HTTP::uri] line 3: [command is not valid in current event context (CLIENT_ACCEPTED)] [HTTP::header host]
when CLIENT_ACCEPTED { if { ([HTTP::uri] contains "webamil.server.com") || ([HTTP::header host] equals "webmail.server.com") } { use pool WEBMAIL_HTTP_POOL return } use pool EDU_PROXY_POOL }
- Hamish
Cirrocumulus
Sorry, the [HTTP::xx] commands are only available in the HTTP_ events... When CLIENT_ACCEPTED triggers, the only thing that has happened is the 3-way handshake... Move the HTP tests (For URI) out to the HTTP_REQUEST event, this event triggers after the client has sent their request (But before that request is sent to the server). - hc_andy_35682
Nimbostratus
Thanks for the explanation Hamish.if { ([HTTP::uri] contains "webamil.*.server.com") || ([HTTP::header host] equals "webmail.*.server.com") }
- Hamish
Cirrocumulus
Note sure you require the complexity of a regex... You could try a glob... e.g.if { [HTTP::uri] matches_glob "webmail.*.server.com"} ...
- hc_andy_35682
Nimbostratus
Hi Hamish,
This works great and it does exactly what I want and I see the source address hitting the webmail_pool as being that of the school's IP address. I wanted to improve on this and was wondering if you could make it match on destination IP address instead. You see all of the schools have a CNAME for their webmail.*.server.com that resolves to say 10.10.10.10.when HTTP_REQUEST { if { [HTTP::header host] matches_glob "webmail.*.server.com" } { persist source_addr 255.255.255.255 240 use pool WEBMAIL_HTTP_POOL return } use pool VMTEST_PROXY_POOL }
I want it to persist based on the school's ip address which was possible when matching using the HTTP:xx code. Why doesn't it do the same when I change it to match on destination IP and keep the source IP as that of the school's IP address??? Is this just a limitation of the IP:xx code or do I need to modify the code in some way. Appreciate any further guidance. Thanks. Andywhen HTTP_REQUEST { if { [IP::addr [IP::local_addr] equals 10.10.10.10] } { persist source_addr 255.255.255.255 240 use pool WEBMAIL_HTTP_POOL return } use pool VMTEST_PROXY_POOL }
- JRahm
Admin
Nice thread guys. Gave me an idea for a tech tip on command efficiencies:
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