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

Filter by:
  • Solution
  • Technology
Answers

Simple URL rewriting

Hello, I'm a newbie in F5 ... My pb is very simple I guess but I cannot find the right method, redirect ou rewriting ? here it is, I need to change a URL call from http://HOST/toto/api/ -> http://HOST/toto/soapapi/

it looks pretty simple indeed. I've tried to set a Profiles Services Rewrite

Thanks for your help

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hi,

Will all requests use this newest URI ?
Just to be sure that you need redirect instead of rewriting.

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hello Yes all requests will use the new URI (API change)

I guess a rewriting is cleaner here isn't it ?

Thanks

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

You can do both, it depends only on what you want to publish.
Remember that the cleanest way might be to redirect users as you're iRule won't be process more than one time for each connection.

Tell us what you want, or I'll give you an example for each and you'll choose.

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Thank you Thomas

The URL I want to rewrite or to redirect is a technical URL. Users won't be impacted but only webservices requests.

An application is requesting a service at http://host/alfresco/api/... (hard coded)

After an upgrade of that webservice the URL is now /alfresco/soapapi/

The thing is I do not know what is after /api/ the page and the variables. I just know they are the same.

So I just need to replace api by soapapi

Hope it's clear. Guillaume

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

If it's about web services, the best solution is to rewrite URI I think.
Does your URI condition is /api or /alfresco/api ?

Here is the iRule for /api condition :

when HTTP_REQUEST {
    if { [string tolower [HTTP::uri]] starts_with "/api" } {
        set uri [string map -nocase {"/api" "/soapapi"} [HTTP::uri]]
        HTTP::uri $uri
    }
}
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

The URL condition is /alfresco/api

Do you think I could do the same with LT Policy ?

Target: http-uri / Event: Request / Action: Replace / parameters: value = /alfresco/soapapi/

Thanks

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Yes you can do the same with LTM policies, but be careful you have to define your values otherwise it will replace everything.
If you define / condition, /alfresco/api for example won't match.

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

I see ... the condition should be "start_with /alfresco/api/"

what do you mean by values ?

In fact the client is requesting several soap services at /alfresco/api/AuthenticationService or at /alfresco/api/DirectoryService or at an other service.

How can I manage the replace ?

Thanks G.

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Yes you're right, you have to use starts_with condition.
I meant by values to fill in this condition, as you wrote / condition in your last post.

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

hello

Just for information its also possible to use Profile Rewrite

Both

Client URI = http://ged.int.mars/alfresco/api/

Server URI = http://ged.int.mars/alfresco/soapapi/

Thanks Guillaume

0