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.
You can rewrite the URI with HTTP::uri and the path with HTTP::path. Here is an example:
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]]
}
}
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).