# Need help with iRule

**URL:** <https://community.f5.com/t/need-help-with-irule/72353>\
**Category:** Technical Forums\
**Tags:** application-delivery\
**Created:** [May 21, 2023, 9:21pm UTC](https://community.f5.com/t/need-help-with-irule/72353 "2023-05-21T21:21:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gopalp](https://avatars.discourse-cdn.com/v4/letter/g/d26b3c/32.png) [@gopalp](https://community.f5.com/u/gopalp)\
**Post date:** [May 21, 2023, 9:21pm UTC](https://community.f5.com/t/need-help-with-irule/72353/1 "2023-05-21T21:21:13Z")

</div>

Hello,We have an existing application [https://abc.com](https://abc.com)&nbsp;which is configured with F5.When we open the page and click on status tab it will route to [https://abc.com/api-status](https://abc.com/api-status). Now the users want to see contents of&nbsp;[https://abc.com/api-status](https://abc.com/api-status)&nbsp;in a new URL [https://xyz.com](https://xyz.com).Is this achievable?If so can you please share the iRule for this.Appreciate your help.

---

<div class="post-metadata">

**Author:** ![Paulius](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/paulius/32/21698_2.png) [@Paulius](https://community.f5.com/u/Paulius)\
**Post date:** [May 21, 2023, 11:02pm UTC](https://community.f5.com/t/need-help-with-irule/72353/2 "2023-05-21T23:02:59Z")

</div>

@gopalp I believe this is would be something that has to be tracked server side. You can perform a redirect after someone goes to [https://abc.com/api-status](https://abc.com/api-status) to [https://xyz.com](https://xyz.com) but because this is most likely going to be a new session to a new FQDN the F5 isn’t going to know how to interpret this and provide content to the user. You should be able to provide some sort of transaction ID, cookie, or referer that allows the [xyz.com](http://xyz.com) site to know that the user is looking for the contents of the output from [abc.com/api-status](http://abc.com/api-status).

---

<div class="post-metadata">

**Author:** ![gopalp](https://avatars.discourse-cdn.com/v4/letter/g/d26b3c/32.png) [@gopalp](https://community.f5.com/u/gopalp)\
**Post date:** [May 22, 2023, 3:46pm UTC](https://community.f5.com/t/need-help-with-irule/72353/3 "2023-05-22T15:46:58Z")

</div>

Thank you for the update.Can you please share a sample iRule to achieve above usecase.

---

<div class="post-metadata">

**Author:** ![Paulius](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/paulius/32/21698_2.png) [@Paulius](https://community.f5.com/u/Paulius)\
**Post date:** [May 22, 2023, 4:34pm UTC](https://community.f5.com/t/need-help-with-irule/72353/4 "2023-05-22T16:34:43Z")

</div>

@gopalp To perform the simple redirect it would be the following but if you did it on the F5 you would never receive the unique HTTP header from the server to carry over the users session after they went to the path you are referring to.

```tcl
when HTTP_REQUEST priority 500 {

    if {[HTTP::host] == "abc.com"} {
        if {[HTTP::uri] == "/api-status"} {
            HTTP::redirect "https://xyz.com/"
        }
    }

}

```

---

<div class="post-metadata">

**Author:** ![JRahm](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/jrahm/32/3327_2.png) [@JRahm](https://community.f5.com/u/JRahm)\
**Post date:** [May 23, 2023, 10:51pm UTC](https://community.f5.com/t/need-help-with-irule/72353/5 "2023-05-23T22:51:18Z")

</div>

if you control both the [abc.com](http://abc.com) and [xyz.com](http://xyz.com) domains, you can do this by hosting both [abc.com](http://abc.com) and [xyz.com](http://xyz.com) in your SNI list on the the client-ssl profile of the single virtual (or…use a different virtual and keep the client-ssl profiles separate). And the iRule that&nbsp; @Paulius &nbsp;shared would be on the shared virtual or only on the [abc.com](http://abc.com) virtual. I’d tweak the iRule slightly but it’s fine the way it is.

```tcl
when HTTP_REQUEST priority 500 {
    if {([HTTP::host] == "abc.com") && ([string tolower [HTTP::uri]] == "/api-status")} {
        HTTP::redirect "https://xyz.com/"
    }
}

```

---

<div class="post-metadata">

**Author:** ![LiefZimmerman](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/liefzimmerman/32/3355_2.png) [@LiefZimmerman](https://community.f5.com/u/LiefZimmerman)\
**Post date:** [June 20, 2023, 11:41pm UTC](https://community.f5.com/t/need-help-with-irule/72353/6 "2023-06-20T23:41:41Z")

</div>

@gopalp &nbsp;- If your post was solved it would be helpful to the community to select \*Accept As Solution\*.  
This helps future readers find answers more quickly and confirms the efforts of those who helped.  
Thanks for being part of our community.  
Lief
