# Irule for redirect

**URL:** <https://community.f5.com/t/irule-for-redirect/5988>\
**Category:** Technical Forums\
**Tags:** irules, design, devops, application-delivery\
**Created:** [December 4, 2013, 3:03pm UTC](https://community.f5.com/t/irule-for-redirect/5988 "2013-12-04T15:03:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![amit\_128525](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@amit\_128525](https://community.f5.com/u/amit_128525)\
**Post date:** [December 4, 2013, 3:03pm UTC](https://community.f5.com/t/irule-for-redirect/5988/1 "2013-12-04T15:03:39Z")

</div>

HeI am trying to understand below irule which is already create don our F5 please advise if possble .

when HTTP\_REQUEST { if {[HTTP::header exists A-Forwarded-For]}{ HTTP::header replace A-Forwarded-For [substr [IP::client\_addr] 0 “%”] } else { HTTP::header insert A-Forwarded-For [substr [IP::client\_addr] 0 “%”] } }

---

<div class="post-metadata">

**Author:** ![Wire](https://avatars.discourse-cdn.com/v4/letter/w/f17d59/32.png) [@Wire](https://community.f5.com/u/Wire)\
**Post date:** [December 4, 2013, 3:19pm UTC](https://community.f5.com/t/irule-for-redirect/5988/2 "2013-12-04T15:19:19Z")

</div>

This iRule is looking for a HTTP header called A-Forwarded-For and if it exists it’s replacing its value with the client IP address for the connection.

This iRule seems to be reliant on you having route domains configured on your unit as it is looking for “%” as a separator. I presume you are running TMOS v10.x.

If the header is not present then it is inserting it with the client IP address as its value.

Basically it’s a way to log the source IP of your HTTP requests through the BIG-IP usually if you use SNAT.

---

<div class="post-metadata">

**Author:** ![amit\_128525](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@amit\_128525](https://community.f5.com/u/amit_128525)\
**Post date:** [December 5, 2013, 8:11am UTC](https://community.f5.com/t/irule-for-redirect/5988/3 "2013-12-05T08:11:34Z")

</div>

Hello thanks for reply where I can see a-forward-for details I can’t see in http header section Regards amit

---

<div class="post-metadata">

**Author:** ![Wire](https://avatars.discourse-cdn.com/v4/letter/w/f17d59/32.png) [@Wire](https://community.f5.com/u/Wire)\
**Post date:** [December 5, 2013, 8:51am UTC](https://community.f5.com/t/irule-for-redirect/5988/4 "2013-12-05T08:51:38Z")

</div>

There are a number of ways to do it, the most simple way is to use your web browser’s integrated developer tools (Open your browser and hit F12).

On a publicly accessible site you can use [http://web-sniffer.net/](http://web-sniffer.net/) to make the request.

You can do a Google search for “view http headers” to get you started.
