# Proxy request using iRule

**URL:** <https://community.f5.com/t/proxy-request-using-irule/37267>\
**Category:** Technical Forums\
**Tags:** dev, irules, devops, application-delivery\
**Created:** [January 13, 2011, 6:56pm UTC](https://community.f5.com/t/proxy-request-using-irule/37267 "2011-01-13T18:56:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Leone\_6274](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@Mike\_Leone\_6274](https://community.f5.com/u/Mike_Leone_6274)\
**Post date:** [January 13, 2011, 6:56pm UTC](https://community.f5.com/t/proxy-request-using-irule/37267/1 "2011-01-13T18:56:24Z")

</div>

Hi,

We’re trying to proxy requests from the external address [https://mydomain.com/application/login/default.php](https://mydomain.com/application/login/default.php) to an internal server . I think the iRule at the link below can do what we want, but when we tried to impliment it, it didn’t work and it’s probably because the datagroup isn’t setup correctly.

> **[DevCentral - An F5 Technical Community](https://community.f5.com/)**
>
> DevCentral is an online technical community where engineers and practitioners collaborate, share knowledge, and solve problems related to F5 technologies and industry trends.

The Pool name is “MyApp” but I’m not sure how to create the datagroup and make it look for addresses with /application/ and redirect them to myapp.local and remove /application/ from the request.

Thanks!

---

<div class="post-metadata">

**Author:** ![hoolio](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@hoolio](https://community.f5.com/u/hoolio)\
**Post date:** [January 13, 2011, 7:07pm UTC](https://community.f5.com/t/proxy-request-using-irule/37267/2 "2011-01-13T19:07:34Z")

</div>

Hi Mike,

If you’re on 10.x you’d want to use this version:

[http://devcentral.f5.com/wiki/default.aspx/iRules/ProxyPassV10.html](http://devcentral.f5.com/wiki/default.aspx/iRules/ProxyPassV10.html)

If you just want to do URI rewriting, you should be able to configure the datagroup as

External datagroup format

“[mydomain.com/application](http://mydomain.com/application)” := “myapp.local/”,

Internal datagroup format (requires 10.1+)

“[mydomain.com/application](http://mydomain.com/application)” { “myapp.local/” }

Or in the GUI:

name: [mydomain.com/application](http://mydomain.com/application)

value: myapp.local/

Aaron

---

<div class="post-metadata">

**Author:** ![Mike\_Leone\_6274](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@Mike\_Leone\_6274](https://community.f5.com/u/Mike_Leone_6274)\
**Post date:** [January 19, 2011, 9:18pm UTC](https://community.f5.com/t/proxy-request-using-irule/37267/3 "2011-01-19T21:18:45Z")

</div>

Yea we’re on 10.0+ finding the older version was a lot easier than the new one, thanks for that link.

I’ve applied the iRule to my virtual server and created the datagroup with the following records:

“/google” := [google.com](http://google.com)

“172.18.252.254/test-google” := [google.com](http://google.com)

When I go to /google I get an iis welcome.png which I’m guessing is from the default Pool. It’s finding the rule and says it’s talking to the new host, but instead it seems to be going to the default pool instead. The author makes this look so simple to setup! I tried setting the default pool to none, but that didn’t work either. Suggestions?

Wed Jan 19 17:09:23 EST 2011 info local/tmm1 tmm1[4593] Rule ProxyPass : VS=Elephant\_LAB\_VS, Host=172.18.252.254, URI=/google/welcome.png: Changing Referer header: [http://172.18.252.254/google/](http://172.18.252.254/google/) to [http://google.com/](http://google.com/)

Wed Jan 19 17:09:23 EST 2011 info local/tmm1 tmm1[4593] Rule ProxyPass : VS=Elephant\_LAB\_VS, Host=172.18.252.254, URI=/google/welcome.png: New [Host=google.com](http://Host=google.com), New Path=/welcome.png

Wed Jan 19 17:09:23 EST 2011 info local/tmm1 tmm1[4593] Rule ProxyPass : VS=Elephant\_LAB\_VS, Host=172.18.252.254, URI=/google/welcome.png: Using default pool Elephant\_LAB\_VS\_RootPool

Wed Jan 19 17:09:23 EST 2011 info local/tmm1 tmm1[4593] Rule ProxyPass : VS=Elephant\_LAB\_VS, Host=172.18.252.254, URI=/google/welcome.png: Found Rule, Client Host=172.18.252.254, Client Path=/google, Server [Host=google.com](http://Host=google.com), Server Path=

Wed Jan 19 17:09:23 EST 2011 info local/tmm1 tmm1[4593] Rule ProxyPass : VS=Elephant\_LAB\_VS, Host=172.18.252.254, URI=/google/: New [Host=google.com](http://Host=google.com), New Path=/

Wed Jan 19 17:09:23 EST 2011 info local/tmm1 tmm1[4593] Rule ProxyPass : VS=Elephant\_LAB\_VS, Host=172.18.252.254, URI=/google/: Using default pool Elephant\_LAB\_VS\_RootPool

Wed Jan 19 17:09:23 EST 2011 info local/tmm1 tmm1[4593] Rule ProxyPass : VS=Elephant\_LAB\_VS, Host=172.18.252.254, URI=/google/: Found Rule, Client Host=172.18.252.254, Client Path=/google, Server [Host=google.com](http://Host=google.com), Server Path=

Wed Jan 19 17:09:23 EST 2011 info local/tmm1 tmm1[4593] Rule ProxyPass : Elephant\_LAB\_VS: 172.18.1.111:62007 → 172.18.252.254:80
