Forum Discussion
External access links pointing to internal - Reverse proxy irule help
Since it doesn't appear your URI patterns are changing, you should be able to get away with a pretty simple STREAM iRule. Add the built-in STREAM profile to the VIP and modify the HTTPS iRule like this:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] eq "store.external.com"} {
if { [string tolower [HTTP::uri]] eq "/au" } {
HTTP::redirect "https://[HTTP::host]/store/aub2c"
} else {
HTTP::header remove Accept-Encoding
STREAM::disable
pool poolname
}
}
}
when HTTP_RESPONSE {
if { [HTTP::header exists Location] } {
HTTP::header replace Location [string map {"site.internal.com" "site.external.com"} [HTTP::header Location]]
}
if { [HTTP::header Content-Type] contains "text" } {
STREAM::expression {@site.internal.com@site.external.com@}
STREAM::enable
}
}
The idea here is that, in every response that is text-based, The following things will happen:
-
If the Location header exists in the response, a redirect, its value will be replaced with the external site name. This is usually the only place that the host name would show up in the HTTP headers of the response.
-
The STREAM iRule will look for and replace any instance of "site.internal.com" with "site.external.com" in the payload. This would affect any document object references in the HTML content (images, javascript, css, etc.).
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