Forum Discussion
Jay_Austad_7258
Nimbostratus
May 13, 2008How to set the URI when nodes use Apache NameVirtualHost directive
I have a client that has several sites on their server farms. These sites are not separated out and running on different IP's or ports, but rather use the Apache NameVirtualHost directive. This look...
Jay_Austad_7258
Nimbostratus
May 13, 2008I got it. I set up the redirect from HTTP to HTTPS iRule provided in the codeshare on this site. Then on the port 443 VIP, I just used the following iRule. It requires all of the VIPs to be named with the FQDN followed by "-443". It uses [virtual] to figure out the name of the VIP, strips the -443, and uses that to check against what the client is providing. Works awesome.
when HTTP_REQUEST {
Set our required hostname based on the VIP name
All vips must be named with the FQDN with "-443" appended
set ::myhostname [getfield [virtual name] "-443" 1 ]
log local0. "Virtual Server: $::myhostname"
if { not ( [HTTP::host] equals $::myhostname ) } {
HTTP::redirect "https://$::myhostname[HTTP::uri]"
}
}
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