Forum Discussion
Steffen_Lenz_29
Nimbostratus
Aug 21, 2007Rewrite URL
hi,
i searched here in this forum a long time for a irule that satisfy my needs but i didn`t get this things started.
I want to rewrite (not redirect!) URIs as follows:
http://server1.company.de -> http://server10.company.de:port
http://server1.company.de/directory1 -> http://server11.company.de
http://server1.company.de/directory2 -> http://server12.company.de/directory
Is there anybody who can give me an example of a irule whch will rewrite this URIs?
Thanks!
Regards,
Steffen
- hoolio
Cirrostratus
Kirk added a very complete ProxyPass codeshare rule (Click here) which should allow you to do this. - Steffen_Lenz_29
Nimbostratus
Posted By hoolio on 08/21/2007 3:21 AM
- Kirk_Bauer_1018
Nimbostratus
You can use a stream profile to modify the response content. Do consider using my ProxyPass iRule and saving yourself a lot of time -- that iRule has been thoroughly tested and you need not modify the rule itself, just create and manage a data group to go along with it. - Kirk_Bauer_1018
Nimbostratus
And the error you are getting is because you changed the host header but did not modify the request URI to remove the "directory1" portion. Also be aware that you have to reverse this whole process if the server sends redirects which are very common. For example, if you got the URI http://server1.company.de/directory2/ to successfully map to http://server12.company.de/directory/ try going to the same URI without the trailing slash. The server will send the browser a redirect to http://server12.company.de/directory/ which you then have to modify back to http://server1.company.de/directory2/ in the headers on the way back to the client. - Steffen_Lenz_29
Nimbostratus
- hoolio
Cirrostratus
The [virtual] command is only valid in 9.4. You can replace all instances of [virtual] with [virtual name] for versions < 9.4. It's just info that's logged anyhow, but this will provide the same output. - Steffen_Lenz_29
Nimbostratus
- Kirk_Bauer_1018
Nimbostratus
You must at least have a "/" after the hostname in each item in each entry. So in your case the data group record would be: - Kirk_Bauer_1018
Nimbostratus
I don't know why they couldn't have left [virtual name] as a valid command in 9.4.X. I will update the docs to mention this. - hoolio
Cirrostratus
Yep. [virtual name] in 9.4 could work as long as 'name' was a reserved word and wasn't used as the actual virtual server name...
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects