Forum Discussion
puluck
Cirrus
Oct 16, 2017Redirection of URL without changing the host header
Hello Everyone
I have requirement where i need to send traffic to external blog site based on URI but host header of client browser should display the original URL.
https://www.abc.com/app...
Lee_Sutcliffe
Nacreous
Oct 16, 2017I've not tested this iRule but the idea is the re-write the host header on HTTP_REQUEST and re-write it back to the original value on HTTP_RESPONSE - resulting the client being unaware this has been changed.
You could also use a Stream expression in an iRule to do this.
when HTTP_REQUEST {
set originalHost "[HTTP::host]"
set newHost "ebc.mysite.com"
if {[HTTP::uri] starts_with "/apple"} {
node 193.13.14.5
snat automap
HTTP::header replace Host $newHost
HTTP::uri /
}
}
when HTTP_RESPONSE {
if {[HTTP::host] equals $newHost} {
HTTP::header replace Host $originalHost
}
}
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