Forum Discussion
raddboy_74501
Nimbostratus
Dec 17, 2009Yet another URI rewrite
With our company divesting, I've been tasked with identifying incoming remote_addr, then intercepting certain URI content and modifying that URI on the fly.
Example: http://www.abc.com/com/usa/wheretogo
identify the com/usa and change it to com/usanew with any prepended or appended URI content remaining the same.
Result: http://www.abc.com/com/usanew/wheretogo
I'm using a Data Group to identify the affect remote_addr, but not sure how to identify the specific URI content and replace it on the fly.
Kevin
4 Replies
- hoolio
Cirrostratus
Hi Kevin,when HTTP_REQUEST { Datagroup check loigic goes here ... Check if path starts with /com/usa/ if {[HTTP::path] starts_with "/com/usa/"}{ Replace /com/usa/ with /com/usanew/ in the path HTTP::path [string map {/com/usa/ /com/usanew/} [HTTP::path]] } }
- mguned_60772
Nimbostratus
Thanks for the info...adding to the question... - hoolio
Cirrostratus
You can change HTTP::path to HTTP::redirect. You're supposed to use a fully qualified URL in a redirect, but all browsers support a local one (URI without a protocol or domain name). - raddboy_74501
Nimbostratus
Hoolio, well done! Works great.
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