Forum Discussion
URL Rewrite
- Jun 05, 2021
Assuming all incoming url starts_with /rec/widgets, you can try below code
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/rec/widgets" } { HTTP::header replace "Host" "sample.com" set new_uri "/api/v2/widgets[string range [HTTP::uri] 12 end]&account_id=5036&domain_key=example" log local0. "new_uri: $new_uri" HTTP::uri $new_uri return } }
Assuming all incoming url starts_with /rec/widgets, you can try below code
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] starts_with "/rec/widgets" } {
HTTP::header replace "Host" "sample.com"
set new_uri "/api/v2/widgets[string range [HTTP::uri] 12 end]&account_id=5036&domain_key=example"
log local0. "new_uri: $new_uri"
HTTP::uri $new_uri
return
}
}
Sanjay,
The iRule is doing his job, by re-writing exactly, how we wanted. However, the page is not loading automatically (or using the incoming URL). When we try manually with a new URL (Enabled log, so I was able to get the new URI) in the browser it is loading. The pool is also reachable from LTM.
- spalandeJun 17, 2021Nacreous
you would need to capture tcpdump, enable logging in iRule to capture request and response and also review devolper tool logs from the browser to see what's happening.
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