Forum Discussion
wowchens
Nimbostratus
Nov 24, 2008Host Header based Routing
Hello: I have a unique(not sure if its unique) requirement with a bunch of my web sites. I am trying to host like 5 externally facing websites using ONE external IP Address. I am wondering to see if there is an IRule that I can use to differentiate requests based on host headers, instead of using a separate IP for each one of them. These sites are very simple html informational ones.
Can someone please help with me with an IRule or something.
Thanks,
Chenna
5 Replies
- wowchens
Nimbostratus
This is what I got my sites working. Please let me know your expert thoughts on this.
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
www.domain1.com { pool domain1 }
www.domain2.com { pool domain2 }
default { discard }
}
} - hoolio
Cirrostratus
That looks great. If you are on 9.4 or higher, you could also use HTTP classes to do this. But the iRule looks fine.
Aaron - steve_88008
Nimbostratus
I am facing this as well. In addtion, what would be the oder of operatiosn for a vip that needs multiple irules? I need to redirectt http to https and route based on host header? - dennypayne
Employee
One note, this does not work with SSL sites, since you can't invoke the iRule before doing the SSL handshake, so unless you have a wildcard cert, you will get hostname mismatches in the browser.
The order of operation of iRules should be in the order they are listed in the GUI. There was a bug about this in earlier versions of 9.x, not sure exactly when it got fixed.
Denny - AndrewO_4840
Nimbostratus
Posted By steve_j on 02/02/2009 8:08 AM
I am facing this as well. In addtion, what would be the oder of operatiosn for a vip that needs multiple irules? I need to redirectt http to https and route based on host header?
You can also use iRule priority to control which rules are processed first.
http://devcentral.f5.com/wiki/default.aspx/iRules/priority.html
So you could have your http->https rewrite with a higher priority (so it runs first) followed by a second rule with a lower priority to do the per-domain filtering.
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
