Forum Discussion
Puneet_SETH
Dec 16, 2019Ret. Employee
URI Rewrite when sending the packet to Backend
Hi All, I'm working on this requirement to rewrite the URI path in the HTTP Request, just the URI path and not the query portion. E.g. Incoming request to http://1.1.1.1/test/abc?param=1234...
Dec 16, 2019
Hi,
for request "http://1.1.1.1/test/abc?param=1234567890"
host : 1.1.1.1
uri : /test/abc?param=1234567890
path : /test/abc
query : param=1234567890If you want to change the host, you can use HTTP::redirect
Sample
Request: http://1.1.1.1/test/abc?param=1234567890
Redirect: https://2.2.2.2/test/abc2?param=1234567890
when HTTP_REQUEST {
if { [HTTP::path] equals "/test/abc" } {
set newUri [string map {"abc" "abc1"} [HTTP::path]]
HTTP::redirect "https://2.2.2.2$newUri?[HTTP::query]"
}
}- Puneet_SETHDec 16, 2019Ret. Employee
Hi,
Here 1.1.1.1 is the VIP and 2.2.2.2 is the backend server.
In original case Host header will be name as it is.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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