# Rewrite an HTTP request

**URL:** <https://community.f5.com/t/rewrite-an-http-request/56367>\
**Category:** Technical Forums\
**Created:** [October 30, 2014, 5:21pm UTC](https://community.f5.com/t/rewrite-an-http-request/56367 "2014-10-30T17:21:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Danny\_Arroyo](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/danny_arroyo/32/33545_2.png) [@Danny\_Arroyo](https://community.f5.com/u/Danny_Arroyo)\
**Post date:** [October 30, 2014, 5:21pm UTC](https://community.f5.com/t/rewrite-an-http-request/56367/1 "2014-10-30T17:21:27Z")

</div>

We are running v11.4.1 on our Bigip F5. I know how to rewrite url’s with an irule however I’m not sure how to go about rewriting the following. A link (which cant be changed) on one of our websites points to “[https://webserver.mycompany.com/cp/render.UserLayoutRootNode.uP?uP\_tparam=utf&utf=%2Fcp%2Fip%2Flogin%3Fsys%3Dsctssb%26url%3D\*\*http://webserver2.mycompany.com/](https://webserver.mycompany.com/cp/render.UserLayoutRootNode.uP?uP%5C_tparam=utf&utf=%2fcp%2fip%2flogin%3fsys%3dsctssb%26url%3d**http://webserver2.mycompany.com/)**devl/twbkwbis.P\_GenMenu?name=bmenu.P\_FinInfoMnu". We need the F5 to look for this HTTP request and when it sees "[http://webserver2.mycompany.com](http://webserver2.mycompany.com)”, it should rewrite it to “\*\*[https://webserver2.mycompany.com](https://webserver2.mycompany.com)**”. Everything else around the HTTP request needs to stay untouched. Can I use a rewrite profile, irule, or some other method to get this done? How would I do this?

---

<div class="post-metadata">

**Author:** ![NikhilB](https://avatars.discourse-cdn.com/v4/letter/n/4bbf92/32.png) [@NikhilB](https://community.f5.com/u/NikhilB)\
**Post date:** [October 30, 2014, 7:17pm UTC](https://community.f5.com/t/rewrite-an-http-request/56367/2 "2014-10-30T19:17:55Z")

</div>

Create new profile using the rewrite uri translation profile to get this completed. Set the rule type as request in your case.

---

<div class="post-metadata">

**Author:** ![Danny\_Arroyo](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/danny_arroyo/32/33545_2.png) [@Danny\_Arroyo](https://community.f5.com/u/Danny_Arroyo)\
**Post date:** [October 30, 2014, 8:17pm UTC](https://community.f5.com/t/rewrite-an-http-request/56367/3 "2014-10-30T20:17:18Z")

</div>

I’m not very good with this but based on what you wrote, this is what I did: 1. Profiles/Services/Rewrite 2. Click “Create New Profile”. Entered a name, chose /Common/rewrite-uri-translation for the “Patent Profile” and set “Uri Translation” for the “Rewrite Mode” 3. Under “URI Translation/Settings/Request Settings”, “Rewrite Headers” and “Insert X-Forwarded-For Header” are checked. 4. Under “URI Translation/Settings/Response Settings”, “Rewrite Headers” and “Rewrite Content” are checked. 5. Under “URI Rules”, I clicked “Add” and selected “Request” for “Rule Type”. Then for the “Client URI”, I pasted in “[https://webserver.mycompany.com/cp/render.UserLayoutRootNode.uP?uP\_tparam=utf&utf=%2Fcp%2Fip%2Flogin%3Fsys%3Dsctssb%26url%3Dhttp://webserver2.mycompany.com/devl/twbkwbis.P\_GenMenu?name=bmenu.P\_FinInfoMnu](https://webserver.mycompany.com/cp/render.UserLayoutRootNode.uP?uP%5C_tparam=utf&utf=%2fcp%2fip%2flogin%3fsys%3dsctssb%26url%3dhttp://webserver2.mycompany.com/devl/twbkwbis.P%5C_GenMenu?name=bmenu.P%5C_FinInfoMnu)”. 6. For “Server URI” I pasted in the same string but with the https instead of http.

However, when I click OK to save it, I get the following error:

MCP Error01070734:3: Configuration error: /Common/name\_uri\_rewrite: Client path ‘/cp/render.UserLayoutRootNode.uP?uP\_tparam=utf&utf=%2fcp%2fip%2flogin%3fsys%3dsctssb%26url%3dhttp://webserver2.mycompany.com/devl/twbkwbis.P\_GenMenu?name’ must begin and end with ‘/’

I probably have it misconfigured, but can’t tell where the problem is. Any ideas?

---

<div class="post-metadata">

**Author:** ![NikhilB](https://avatars.discourse-cdn.com/v4/letter/n/4bbf92/32.png) [@NikhilB](https://community.f5.com/u/NikhilB)\
**Post date:** [October 30, 2014, 9:02pm UTC](https://community.f5.com/t/rewrite-an-http-request/56367/4 "2014-10-30T21:02:48Z")

</div>

name must begin and end with ‘/’

---

<div class="post-metadata">

**Author:** ![Danny\_Arroyo](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/danny_arroyo/32/33545_2.png) [@Danny\_Arroyo](https://community.f5.com/u/Danny_Arroyo)\
**Post date:** [October 31, 2014, 5:21pm UTC](https://community.f5.com/t/rewrite-an-http-request/56367/5 "2014-10-31T17:21:57Z")

</div>

Thanks. I see that. But what name is being referenced?
