Forum Discussion
Need help creating a irule to reverse proxy .
If I read this correctly, when the customer sends http://www.lightsource.com/blog, you want the backend server to see what is essentially http://lightsource.wpengine.com. The be pedantic, you want the Host: header to change from www.lightsource.com to lightsource.wpengine.com and the request-uri to change from /blog to /. You do not want to perform an HTTP redirect because you want this change to be transparent to the user-agent.
You can solve this on 11.4 or higher using a Local Traffic Policy:
Here is an example:
ltm policy lightsource-rewrite {
controls { forwarding }
requires { http }
rules {
rule01 {
actions {
0 {
http-host
replace
value lightsource.wpengine.com
}
1 {
http-uri
replace
path /
}
}
conditions {
0 {
http-host
host
values { www.lightsource.com }
}
1 {
http-uri
path
values { /blog }
}
}
ordinal 1
}
}
strategy first-match
}
Alternatively, you can do the same in an iRule:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] eq "www.lightsource.com" and [HTTP::path] eq "/blog" } {
HTTP::replace Host lightsource.wpengine.com
HTTP::path "/"
}
}
- Mel_153429Dec 17, 2015
Nimbostratus
Vernon, Thanks for the responses! I just to make sure we are on the same page. When the end user go to www.lightsource.com/blog they are proxy over to lightsource.wpengine.com but the web address in their browser remain www.lightsource.com/blog and all action is transparent to the user. Is that what you saying as well? Thanks
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
