Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

Rewrite http host and URL with iRule

Hi Community,

I would greatly appreciate a little help with this challenge:

External clients will hit the LTM with a own http host "connect.test.company.org/URI" and we do need to modify this requests that the webserver understands it: "abctest.company.org/connect/URI

As I am not very familiar with developing, I wanted to ask if anyone can check this iRule or give me a better idea :-)

Thanks, Manuel

0
Rate this Question
Comments on this Question
Comment made 08-Oct-2014 by Manuel 210
sorry, the rule is missing: when HTTP_REQUEST { if { [HTTP::host] starts_with "connect" } { HTTP::redirect "https://abctest.company.org/connect/[HTTP::uri]" } }
0

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hi Manuel, HTTP::redirect tell user's browser to go to a different location, that is different from what you need.

I suggest you to use rewrite profile, so you don't need to create an irule. Find below a good explanation and example: http://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/ltm-implementations-11-5-0/23.html

1
Comments on this Answer
Comment made 08-Oct-2014 by Manuel 210
Hi Tiziano and thanks for your response! The link is really great - exactly what I was looking for :-) Just one more question: does this also work without terminating SSL on the Big-IP? That would be the actual design and in this guide it is mentioned that SSL termination is required.
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

If you use HTTPS, yes it's required because F5 needs to "read" the http traffic.

0
Comments on this Answer
Comment made 21-Oct-2014 by Ashish Ram Takawale 66
Hello Tiziano, I have same kind of requirement, but In my case I the server is present on the Internet and I don't have pool attached to VS. User will come via www.abc.com F5 need to replace the host with www.pqr.com/abc/. But user will see only www.abc.com in his we browser. Regards, Ashish
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Ok, got it.

Is there any way I can solve this without terminating SSL? I guess we would consider using an iRule in this case, right?

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

I don't think you can do what you need without SSL termination, because you have to change the URI sent to the backend servers.

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

One last question: if I use a rewrite profile, will it keep the paths or queries behind the host that I am redirecting? E.g. user accesses "connect.test.company.org/test/site/query" will it be translated to "abctest.company.org/connect/test/site/query"?

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Image Text

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Ok, I understand that part.

If the user will come up with different http paths or queries, is there anyway to maintain this values. Unfortunately we cannot define all paths a user potentially could go, so we need a wildcard (as we would use the [HTTP::uri] or [HTTP::path] in an iRule.

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

you can also rewrite only the host, if makes sense: http://connect.test.company.org/ ---> http://abctest.company.org/

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Alright, thank you. I will try if a combination of rewriting the host and uri, but keeping the rest of the http path is possible. Else wise I will use iRule. Thanks for your support!

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

tiziano, Where is that GUI Application from for Portal Re Write, I have not seen this before?

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hi, like described in this link: https://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/ltm-implementations-11-5-0/23.html you will find it here: Local Traffic > Profiles > Services > Rewrite

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Thanks for your quick answer..see learn something new everyday :)

0