Forum Discussion
Jose_Santiago_O
Nimbostratus
Nov 02, 2005Redirecting real http users.
Hello,
I've just migrated from big-ip 4.5.11 to 9.1. In big-ip 4.5 We had a rule to redirect real-server requests (port 8080) from the original URI to URI+?usehostname, since this is the valid syntax to have the real servers behind a NAT or LB.
This is the rule in 4.5:
rule real_http {
if (not (http_uri ends_with "hostname")) {
redirect to "http://%h:8080/%u?usehostname"
}
else {
use pool pool_real_8080
}
}
I'm trying to do the same with big-ip 9.1, and so far it hasn't worked yet.
This is the new rule:
when HTTP_REQUEST {
if {[HTTP::uri] ends_with "usehostname"} {
pool pool_real_8080
}
else {
[HTTP::redirect "http://[HTTP::host]:8080/[HTTP::uri]?usehostname"]
}
}
The rule checks if the URI ends with usehostname, if it does, then I redirect to the pool, if it doesn't, I redirect the user to same host appending the "?usehostname" to the original URI.
When the request is: http://1.2.3.4:8080/ramgen/file.rm?usehostname >> It works.
When the request is: http://1.2.3.4:8080/ramgen/file.rm >> It doesn't work. (?)
My real servers log the requests with the URI ending in ?usehostname with status code 200 always, but the clients can't see any files.
Any ideas what should be happening?
Thanks in Advance.
Jose Santiago Oyervides.
- Try taking the HTTP::redirect command out of the brackets. Also, HTTP::uri begins with a slash and you included one so you'll end up with a double slash at the beginning of the uri which is probably not what you were intending.
when HTTP_REQUEST { if {[HTTP::uri] ends_with "usehostname"} { pool pool_real_8080 } else { HTTP::redirect "http://[HTTP::host]:8080[HTTP::uri]?usehostname" } }
- Looks like Colin beat me to the punch...
- Jose_Santiago_O
Nimbostratus
Thanks guys.
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