Forum Discussion
iRule to assign node based on URI, bypassing source IP persistence
Hello,
We are using a standard VS to load balance HTTPS traffic to 2 web servers, using source IP persistence. For a particular statistics application we need to bypass load balancing and persistence and send the HTTPS traffic to the 2nd web server.
I customized this iRule to catch the URI /stats/stats.js and send to a pool containing only the 2nd server :
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] starts_with "/stats/" } {
pool stats.https.pool
}
else {
pool website.https.pool
}
}
The default condition seems to work fine as all URI's are working. But on the /stats/stats.js URI I get permanently 404's.
According to a logging iRule I'm using I see that regular traffic is sent to either one or the other web servers, and the /stats/ traffic to the 2nd one only... But I still get 404's. Also CURL from the BIG-IP shows that the URL is accessible on the destination server.
I tried to add 'persist none' before the pool assignment but that didn't help.
Any advise would be strongly appreciated ! I'm sure this is a basic problem but I don't get it right now 🙂
Cheers,
Gerald
7 Replies
- JG
Cumulonimbus
Have you already attached a OneConnect profile to this virtual server?
- Gerald_Meese
Cirrus
I tried with either the default OneConnect profile (S/M 0.0.0.0) and a custom one with a S/M 255.255.255.255 but that doesn't help.
- JG
Cumulonimbus
The point of using a OneConnect profile is to have the LB decision made on each HTTP request, rather than at the start of a tcp connection only.
Are you sure the user is hitting the right website? Did you specify the right hostname when testing with curl?
- Gerald_Meese
Cirrus
Just tested it again with CURL to the IP of the 2nd web server :
curl -vk https://10.x.x.x/piwik/piwik.js > GET /piwik/piwik.js HTTP/1.1 < HTTP/1.1 200 OK < Content-Type: application/javascript - JG
Cumulonimbus
Aha! You did not specify the hostname! You need to add "-H Host: my.host.name" to the curl command.
- Gerald_Meese
Cirrus
I believe you found the cause of the problem 🙂
curl -vk -H "Host: www.----------.--" https://10.x.x.x/piwik/piwik.js > GET /piwik/piwik.js HTTP/1.1 > Host: www.----------.-- < HTTP/1.1 404 Not Found - Gerald_Meese
Cirrus
My colleagues added the missing alias in the vhost config on the Apache server and that fixed the problem. Thanks Jie for your help !
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
