# IRULE to MATCH any URI after the HTTP HOST Header

**URL:** <https://community.f5.com/t/irule-to-match-any-uri-after-the-http-host-header/47923>\
**Category:** Technical Forums\
**Tags:** irules, big-ip, application-delivery\
**Created:** [February 17, 2021, 11:49am UTC](https://community.f5.com/t/irule-to-match-any-uri-after-the-http-host-header/47923 "2021-02-17T11:49:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deepak\_Nair](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@Deepak\_Nair](https://community.f5.com/u/Deepak_Nair)\
**Post date:** [February 17, 2021, 11:49am UTC](https://community.f5.com/t/irule-to-match-any-uri-after-the-http-host-header/47923/1 "2021-02-17T11:49:00Z")

</div>

Hi Experts ,

I am working on one request where CLIENT makes a request to VIP using [https://myjobrocks.com/xyz](https://myjobrocks.com/xyz) .This URL should be re-builded to another URI [https://myjobrocks.com/xyz](https://myjobrocks.com:6443/xyz) or [https://myjobrocks.com/xyz/home](https://myjobrocks.com:6443/xyz/home) etc and send to node in the backend server using its machine name .

Client to VIP ----\> [https://myjobrocks.com/xyz](https://myjobrocks.com/xyz)

VIP to Backend ----\> https://\<machine-name\>:443/xyz

Client should NOT see the VIP to backend communication .

ALSO , the /xyz PATH contains /xyz/home/groups/siginin etc pages in it

I wrote an IRULE but it works only a part of xyz/home URI , not for other PATH when I click while I reach /xyz/home

When I click something in the Home page , its returns 404 error .

when HTTP\_REQUEST {

if {([string tolower [HTTP::host]] equals “[myjobrocks.com](http://myjobrocks.com)”)&nbsp;&&&nbsp;&nbsp;[HTTP::uri] starts\_with “/xyz” }

{

HTTP::uri&nbsp;"/xyz[HTTP::uri]

node 1.1.1.1 443

}

I am NOT sure how to append the REST of URI request made by the Client .

---

<div class="post-metadata">

**Author:** ![Mayur\_Sutare](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/mayur_sutare/32/5035_2.png) [@Mayur\_Sutare](https://community.f5.com/u/Mayur_Sutare)\
**Post date:** [February 17, 2021, 5:41pm UTC](https://community.f5.com/t/irule-to-match-any-uri-after-the-http-host-header/47923/2 "2021-02-17T17:41:41Z")

</div>

Hello,

When you are hitting URI **/xyz/home** or **xyz/something,** do you see if whole URI is preserved in the browser?

---

<div class="post-metadata">

**Author:** ![Deepak\_Nair](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@Deepak\_Nair](https://community.f5.com/u/Deepak_Nair)\
**Post date:** [February 18, 2021, 1:26am UTC](https://community.f5.com/t/irule-to-match-any-uri-after-the-http-host-header/47923/3 "2021-02-18T01:26:51Z")

</div>

Hi Mayur ,

When i browse to [https://myjobrocks.com/xyz](https://myjobrocks.com/xyz) it HITS the F5 VIP and land on [https://myjobrocks.com/xyz](https://myjobrocks.com/xyz)/home perfectly using below irule :

when HTTP\_REQUEST {

if {([string tolower [HTTP::host]] equals “[myjobrocks.com](http://myjobrocks.com/)”)&nbsp;&&&nbsp;&nbsp;[HTTP::uri] starts\_with “/xyz” }

{

node 1.1.1.1 443

}

Inside Home i have different PATH and when i click on that i can see the PATH are preserved in the browser but when that PATH is appended , the request change from https to http . i am NOT sure why is this happening . Also when i try to open .html page within Home , its stays as https BUT gets a error as below

Invalid redirect\_uri

**Error:** 400

When i USe this irule :

when HTTP\_REQUEST {

if {([string tolower [HTTP::host]] equals “[myjobrocks.com](http://myjobrocks.com/)”)&nbsp;&&&nbsp;&nbsp;[HTTP::uri] starts\_with “/xyz” }

{

HTTP::uri&nbsp;"/xyz[HTTP::uri]

node 1.1.1.1 443

}

Nothing works and gets server error .

---

<div class="post-metadata">

**Author:** ![Deepak\_Nair](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@Deepak\_Nair](https://community.f5.com/u/Deepak_Nair)\
**Post date:** [February 18, 2021, 5:33am UTC](https://community.f5.com/t/irule-to-match-any-uri-after-the-http-host-header/47923/4 "2021-02-18T05:33:22Z")

</div>

OK i think i found the problem . The other URI path within /XYZ is hosted on http instead of https . Looks like i need to create a VIP with port 80 to service this paths .

testing this now

---

<div class="post-metadata">

**Author:** ![Deepak\_Nair](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@Deepak\_Nair](https://community.f5.com/u/Deepak_Nair)\
**Post date:** [February 18, 2021, 5:49am UTC](https://community.f5.com/t/irule-to-match-any-uri-after-the-http-host-header/47923/5 "2021-02-18T05:49:03Z")

</div>

OK this works now . Just created a VIP with Port 80 and attached the irule below

when HTTP\_REQUEST {

if {([string tolower [HTTP::host]] equals “[myjobrocks.com](http://myjobrocks.com/)”)&nbsp;&&&nbsp;&nbsp;[HTTP::uri] starts\_with “/xyz” }

{

HTTP::uri&nbsp;"/xyz[HTTP::uri]

node 1.1.1.1 80

}

Thanks Every one .
