Forum Discussion
brettbeggs_1177
Nimbostratus
Apr 07, 2010iRule Request - strip sub domains
I'm trying to create an iRule that can be used similar to the following mod rewrite command:
RewriteCond %{HTTP_HOST} ^.+\.(.+)\.mydomain\.com$ [NC]
RewriteRule ^(.*)$ https://%1.mydoma...
brettbeggs_1177
Nimbostratus
Apr 08, 2010Thanks Aaron.
I ended up having to make one little tweak, adding "https://" to the response code to get it sent over to the correct place.
Send a redirect with the third to last field from the requested host prepended to .mydomain.com
HTTP::respond 301 Location "https://[lindex $host_list [expr {[llength $host_list] -3}]].mydomain.com"
The problem now seems to be that the redirect isnt taking place before the request hits the virtual server. This is causing a certificate error to pop up. Once you add the exception and advance past it, the redirect works like a champ. I guess on some level that makes sense. The request has to hit the virtual server before it processes the iRule, but in doing so, causes the certificate exception.
When monitoring the logs, nothing gets logged until after you accept the certificate warning.
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