Forum Discussion
need help figuring out a proxy irule
The below post has a bunch of good information that I think has me in the right direction.
http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/aff/5/aft/1172576/afv/topic/asg/50/Default.aspx
however, here's what I need to accomplish.
I have www.domain.com/somestring This is a vanity url that will proxy to new.domain.com/ However, I need to retain in the browser www.domain.com/somestring.
What I am unclear on is how it's possible to proxy traffic to a pool while having the domain name change.
The pool I'm sending it to has a webserver that hosts 3 blogs (new.domain.com) being one of them. They are all configured to be blog1.domain.com, blog2.domain.com and now mine... new.domain.com).
If I just do something like if { [HTTP::host] == "www.domain.com" and [HTTP::uri] == "/somestring" } { pool blogservers } there's no way for the webserver to know what virtual host to send the request to. Is there some way I can say set [HTTP::host] == "new.domain.com" and have the webserver understand it's the new domain, but not actually change the url?
- Ben_95489Nimbostratus
Hey Derek,
I recently did something very similar using the ProxyPass rule that Kirk put in the Code Share here: http://devcentral.f5.com/wiki/default.aspx/iRules/ProxyPass.html It's a fairly complex rule but does the trick. I used it to mask/copy traffic from entirely disparate second level domains with great success (i.e. a user can surf www.derp-de-derp.com just as though it were www.original-site.com). The rule will re-write the host header and links as appropriate on the pages.
// Ben
- Derek_Murphy_38Nimbostratusactually, I have an additional question already. It looks like the way the proxypass irule works is it affects the entire virtual server.
- Ben_95489Nimbostratus
Hey Derek,
This is definitely possible. In fact, I did something not entirely dissimilar. Check out some of the address-related commands here: http://devcentral.f5.com/wiki/default.aspx/iRules/IP.html
You can do the matching in the rule for fairly small addresses, but it is probably better to use matchclass (http://devcentral.f5.com/wiki/default.aspx/iRules/matchclass.html) for this. Here's roughly what the rule I put together looked like:
- Ben_95489NimbostratusHey Derek,
- Derek_Murphy_38NimbostratusThat's great info Ben.
- Ben_95489NimbostratusHey Derek,
- Derek_Murphy_38NimbostratusDo I need to have a delimiter in the data group? it didn't seem like it was a requirement from the comments in the irule.
- Ben_95489NimbostratusHey Derek,
- Derek_Murphy_38Nimbostratusnope, I think you're right re: whitespace being the default delimiter. All of the examples I can find seem to have whitespace in their examples.
- Derek_Murphy_38Nimbostratuswell, at least now I'm getting consistency. As soon as I apply the proxy_pass irule to my main web virtual server in staging, I get a "The connection was reset" error when accessing any page.
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