Forum Discussion
Kevhed
Nimbostratus
Jan 19, 2016Rewrite host domain URL
I've been looking thru many posts about rewriting and reverse proxy and cannot find what I'm looking for. I attempted to use a Rewrite Profile but that did not let me change the host/domain portion ...
Kai_Wilke
MVP
Jan 19, 2016Hi Kevhead,
to rewrite the HOST name for the provided URI you could use this code...
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] equals "/98/02/9802240_a.abc_med.jpg" } then {
HTTP::host "images.mydomain-b.com"
}
}
Note1: For LTM deployments prior to v11.5, you have to the code below...
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] equals "/98/02/9802240_a.abc_med.jpg" } then {
HTTP::header replace Host "images.mydomain-b.com"
}
}
Note2: The outlined code covers exactly your provided requirements. It changes the HTTP request for the given JPG file. If you need additional rewrites based on additional web directories or even for the entire site, then let us know. Be as precise as possible... 😉
Cheers, Kai
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