Forum Discussion
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
10 Replies
- Thomas_Gobet
Nimbostratus
Hi,
Will all requests use this newest URI ?
Just to be sure that you need redirect instead of rewriting. - VOLA_144433
Nimbostratus
Hello Yes all requests will use the new URI (API change)
I guess a rewriting is cleaner here isn't it ?
Thanks
- Thomas_Gobet
Nimbostratus
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.
- VOLA_144433
Nimbostratus
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
- Thomas_Gobet
Nimbostratus
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 } } - VOLA_144433
Nimbostratus
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
- Thomas_Gobet
Nimbostratus
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. - VOLA_144433
Nimbostratus
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.
- Thomas_Gobet
Nimbostratus
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. - VOLA_144433
Nimbostratus
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
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com