Forum Discussion
davidq_20688
Nimbostratus
Jun 06, 2011HTTP Profile for re-direct
Hi All,
The company I work for has requested we set up a virtual server, which will effectively redirect all incoming HTTP requests.
We have set up a http profile to do this job, however, the redirect is not working as expected.
The virtual server is instead appending the url (of the desired redirect site), to the original url.
Would any of you be able to advise why this is occuring?
Any help would be much appreciated.
Thanks.
7 Replies
- nitass
Employee
may we see the http profile config?
b profile (profile name) list - davidq_20688
Nimbostratus
Sorry for the belated reply.
The profile config (using the b profile xxx list command) is:
profile http xxx_http_profile {
defaults from http
fallback "xxx.html"
}
Fairly simple I know, but the objective is also fairly simple.
So, any ideas? - Josh_Hill_17083
Nimbostratus
You are doing it right I think, but you may need a redirect irule to redirect based on the uri entered if you want to redirect to a different hostname, otherwise the LTM will simply use the same hostname and append, as you have discovered.
So if you are using fallback.html in the profile, add an irule like:
when HTTP_REQUEST {
if {([HTTP::uri] eq "fallback.html") } {
HTTP::redirect "http://www.fallbackhost.com/fallback.html"
}
} - nitass
Employee
when pool is down, what is output of the folllowing command?
curl -i http://vip/ - hoolio
Cirrostratus
What you're seeing is expected browser behavior.
If you specify a local URI for a redirect, the browser will automatically append that redirect location to the current URL. If you want the client to make a request with the same protocol (http or https) to the same FQDN but with a new path of /fallback.html, you should specify the fallback host as /fallback.html. This doesn't follow the exact requirements of RFC2616 but it works.
If you want to replace the host in the redirect, you will need to specify a full URL like http://www.example.com/fallback.html.
Aaron - hoolio
Cirrostratus
... - hoolio
Cirrostratus
What you're seeing is expected browser behavior.
If you specify a local URI for a redirect, the browser will automatically append that redirect location to the current URL. If you want the client to make a request with the same protocol (http or https) to the same FQDN but with a new path of /fallback.html, you should specify the fallback host as /fallback.html. This doesn't follow the exact requirements of RFC2616 but it works.
If you want to replace the host in the redirect, you will need to specify a full URL like http://www.example.com/fallback.html.
Aaron
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
