Forum Discussion
Nacho_de_Aguina
Nimbostratus
Nov 08, 2005Redirector Problem
Hello everybody:
I´m trying to forward http requests to one or other Web server depending on the http header.
Example.
http://VirtualServer/magallanes --> Should go to Magallanes HOst
http://VirtualServer/hansolo --> Should go to Hansolo host
SO i have created a VS (stardard mode) with SNAT automode. and two pools one with each server.
I have added this IRule
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/magallanes" } {
pool pool_magallanes
}
elseif { [HTTP::uri] starts_with "/hansolo" } {
pool pool_hansolo
}
}
But it doesn´t works, i get a message in my browser that the page cannot be displayed
Thanks in advance
Nacho
10 Replies
Sort By
- JRahm
Admin
Try adding some logging:log "Host is [HTTP::host], URI is [HTTP::uri]" when HTTP_REQUEST { if { [HTTP::uri] starts_with "/magallanes" } { log "IF successful on URI [HTTP::uri]" pool pool_magallanes } elseif { [HTTP::uri] starts_with "/hansolo" } { log "ELSEIF successful on URI [HTTP::uri]" pool pool_hansolo } }
- Nacho_de_Aguina
Nimbostratus
Excuse me, but i´m new with BigIP - JRahm
Admin
You can create what I posted as a new rule, or you can update your rule, either way will work. The log command by default logs to /var/log/ltm. - Nacho_de_Aguina
Nimbostratus
log "Host is [HTTP::host], URI is [HTTP::uri]" - JRahm
Admin
Yeah, my bad on that. The first log line should go immediately after the when HTTP_REQUEST, but before your if statement. - Nacho_de_Aguina
Nimbostratus
Nov 8 17:34:31 tmm tmm[714]: 01220002:6: Rule logfile : Host is 150.200.200.4, URI is /magallanes - JRahm
Admin
There isn't a problem with the rule or the vip that I can see, check your 10.200.200.4 server to see if /magallanes is a valid directory in your httpd.conf file. I'm guessing you really want to strip the URI once it has been used to determine the server. Try this:when HTTP_REQUEST { log "Host is [HTTP::host], URI is [HTTP::uri]" if { [HTTP::uri] starts_with "/magallanes" } { log "IF successful on URI [HTTP::uri]" HTTP::uri "/" pool pool_magallanes } elseif { [HTTP::uri] starts_with "/hansolo" } { log "ELSEIF successful on URI [HTTP::uri]" HTTP::uri "/" pool pool_hansolo } }
- Nacho_de_Aguina
Nimbostratus
Nov 8 17:59:30 tmm tmm[714]: 01220002:6: Rule logfile2 : Host is 150.200.200.4, URI is /magallanes - JRahm
Admin
Have you checked your server? Add this to your rule: - Nacho_de_Aguina
Nimbostratus
There is no entries in the log file refering anything about the irule that says:
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