Forum Discussion
Marker_58065
Dec 22, 2010Nimbostratus
Sorry about the confusion...this one is totally different. Now I am just taking about a standard url redirect, like a user puts in 'site1' and gets sent to 'http://sharepoint.domain.net/somesite/etc/'. I got about 300 of them all on 1 virtual. I have the same problem with not always getting the full domain in the host request. Today I have this:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
site1* {
HTTP::redirect https://sharepoint.domain.net/sites/default.aspx
}
helpdesk* {
HTTP::redirect http://remedy.domain.net/login
}
dashboard* {
HTTP::redirect https://dashboards.domain.net/corda/dashboards/
}
}
}
It is a really long irule, but it works. Seems like a datagroup would be easier to maintain than this. I came up with this, but I am wondering if there would be a better way.
class URL-REDIRECTS {
{
site1 { "https://sharepoint.domain.net/sites/default.aspx" }
helpdesk { "http://remedy.domain.net/login" }
dashboard { "https://dashboards.domain.net/corda/dashboards/" }
}
}
when HTTP_REQUEST {
Remove domain and look up the requested host in the datagroup
set Host [class search -value URL-REDIRECTS eq [string map -nocase {".domain.net" ""} [HTTP::host]]]
log local0. "Host var is $Host"
if { $Host ne "" } {
HTTP::redirect $Host
}
}
Maybe I should have started a new thread on this one.....Anyway, I hope that clears up what I am trying to do. Thanks!