Forum Discussion
Jonas_Isaksson_
Nimbostratus
Apr 28, 2015Allowed IP for "Host based virtual hosting".
Hi,
I have a small problem that i need a few pointers on the way to solve.
I have an VS that is 'Standard' and using the standard 'HTTP Profile'.
The VS has an iRule to determine the hostname t...
Jonas_Isaksson_
Nimbostratus
Apr 29, 2015I solved it by using a 'Data Group' that corresponds with the name of the pool.
Also added 'X-Forwarded-For' to be used for better logging on the webservers since we use SNAT.
when HTTP_REQUEST {
set xff 0
foreach x [HTTP::header names] {
if { [string tolower $x] equals "x-forwarded-for" } {
set xff 1
HTTP::header remove $x
HTTP::header insert X-Forwarded-For [IP::client_addr]
}
}
if { $xff == 0 } {
HTTP::header insert X-Forwarded-For [IP::client_addr]
}
set HOST [HTTP::host]
if {[catch {pool "P_EXT_$HOST"}] || [scan [HTTP::host] {%d.%d.%d.%d} 0 0 0 0] == 4}{
reject
}
else {
if {[class exists "DG_EXT_$HOST"] } {
if {![class match [IP::client_addr] eq "DG_EXT_$HOST"]} {
reject
} else {
pool "P_EXT_$HOST"
}
} else {
pool "P_EXT_$HOST"
}
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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