# Rewrite profile - any better way?

**URL:** <https://community.f5.com/t/rewrite-profile-any-better-way/14212>\
**Category:** Technical Forums\
**Tags:** local-traffic-policy, devops, ltm, http-to-https\
**Created:** [November 14, 2017, 7:29pm UTC](https://community.f5.com/t/rewrite-profile-any-better-way/14212 "2017-11-14T19:29:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Piotr\_Lewandows](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@Piotr\_Lewandows](https://community.f5.com/u/Piotr_Lewandows)\
**Post date:** [November 14, 2017, 7:29pm UTC](https://community.f5.com/t/rewrite-profile-any-better-way/14212/1 "2017-11-14T19:29:27Z")

</div>

Hi,

I wonder is there is any simpler way to achieve something described below:

Scenario:

- Single VS - IP mapped to few external FQDNs
- Each external FQDN maps to virtual host on the same backend server (so traffic accepted only if there is Host header match in request send from BIG-IP to backend)
- There is possibility that some links returned from backend (in content) are not relative and can use backend srv FQDN.

Setup:

Local Traffic Policy forwarding traffic to appropriate pool based on host header in request from client - sure it could be one pool but because FQDN nodes has to be used I guess separate pools are needed - or not?

Then Rewrite profile with URI rules for each ext FQDN to int FQDN with Rewrite Header, Rewrite content set, like \* → \* → \* → \* and so on

When redirect from http to https (send from backend) is needed then another Rewrite profile is necessary for HTTPS VS: \* → \* → \* → \* and so on

It is working OK but requires plenty of objects to be configured, everything has to be entered by hand, in few places and cause a lot of work and possibility to make mistake ☹

Is there any other way (simpler, less error prone) to achieve the same goal?

Piotr

---

<div class="post-metadata">

**Author:** ![rob\_carr](https://avatars.discourse-cdn.com/v4/letter/r/a87d85/32.png) [@rob\_carr](https://community.f5.com/u/rob_carr)\
**Post date:** [November 15, 2017, 1:54am UTC](https://community.f5.com/t/rewrite-profile-any-better-way/14212/2 "2017-11-15T01:54:57Z")

</div>

_Is there any other way (simpler, less error prone) to achieve the same goal?_

No, not really. Prior to the rewrite profile, you would have needed to use a datagroup and either an iRule or Traffic Policy to accomplish the same goal, which I think many would find to be more difficult than the setup you’ve described.

---

<div class="post-metadata">

**Author:** ![stan\_piron](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@stan\_piron](https://community.f5.com/u/stan_piron)\
**Post date:** [November 15, 2017, 7:58am UTC](https://community.f5.com/t/rewrite-profile-any-better-way/14212/3 "2017-11-15T07:58:16Z")

</div>

Is there any other way (simpler, less error prone) to achieve the same goal?

of course there is! this will also optimize F5 and servers performances:

CONFIGURE INTERNAL SERVER TO ACCEPT EXTERNAL HOSTNAME AND TO RESPOND WITH RELATIVE URI

---

<div class="post-metadata">

**Author:** ![dragonflymr](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dragonflymr](https://community.f5.com/u/dragonflymr)\
**Post date:** [November 16, 2017, 8:14am UTC](https://community.f5.com/t/rewrite-profile-any-better-way/14212/4 "2017-11-16T08:14:57Z")

</div>

Hi,

Assuming that using Rewrite profile is only option (even if worst one) how to solve missing trailing / issue?

If URI Rule is like that:

- Client: [Login | HSTS Redirection Community](http://site.com/old/)
- Server:

and user will send request without trailing /, like /old

URI rule will not catch such request.

Some web servers (for sure my IIS) is sending back redirect when receiving such request (but I doubt it’s standard behavior for all types of web servers?) so client will be redirected to /old/ and then URI rule fires.

But it’s not perfect - if backend server will not send redirect then everything breaks up. Even if it will send then it is not best situation as /old request are still reaching backend.

I am right now using iRule I found on DevCentral to fix such requests at VS level, because iRule is executed before Rewrite profile it seems to be working solution.

But maybe it’s not a right approach, maybe I am missing something important that could break backend server functionality somehow?

Piotr

---

<div class="post-metadata">

**Author:** ![ishhyd82](https://avatars.discourse-cdn.com/v4/letter/i/c67d28/32.png) [@ishhyd82](https://community.f5.com/u/ishhyd82)\
**Post date:** [June 8, 2022, 7:12pm UTC](https://community.f5.com/t/rewrite-profile-any-better-way/14212/5 "2022-06-08T19:12:24Z")

</div>

Hi Piotr,

Can you share the irule if possible

Regards
