Forum Discussion

meenny_60187's avatar
meenny_60187
Icon for Nimbostratus rankNimbostratus
Apr 30, 2012

Redirect friendly host name to https URL

I'm having issues redirecting a friendly name to an internal https SharePoint site.

 

 

User enters: soc1

 

iRule redirect: https://epwork.ep.corp/bu/it/soc

 

 

 

"soc1" is a friendly name, or internal DNS host record that points to the load balancer virtual host IP 172.20.110.204

 

 

 

"epwork" also points to the same IP 172.20.110.204

 

 

 

 

 

when HTTP_REQUEST {

 

if { [HTTP::host] contains "soc1" } {

 

HTTP::redirect "https://epwork.ep.corp/bu/it/soc1"

 

} }

 

 

 

If i simply type in "soc1" in internet explorer and hit enter, it brings me to the Bing search engine.

 

 

 

If i type in "http://soc1" it gives me an "Internet Explorer cannot display the webpage" error page.

 

 

 

When going directly to "https://epwork.ep.corp/bu/it/soc1", the page loads as expected.

 

 

 

If possible, I don't want to have to manually type http:// before "soc1". I simply want to type in "soc1" and have it redirect to the URL "https://epwork.ep.corp/bu/it/soc1".

 

 

 

Is there a better way to go about this, or am i doing this all wrong?

 

 

 

  • If i type in "http://soc1" it gives me an "Internet Explorer cannot display the webpage" error page.

     

    Is the VIP with that iRule listening on port 80? It doesn't sound like it is. Try creating a port 80 VIP and assign that iRule to it... Leave that iRule off the https VIP.

     

     

    John
  • you may want to try using a matchclass and datagroup combination for this:

     

     

    rule soc1_class_rule {

     

    when HTTP_REQUEST {

     

    if {[class match [string tolower[HTTP::host]] equals test_class]}{

     

    HTTP::redirect "https://epwork.ep.corp/bu/it/soc1"

     

    } else {

     

    do something else}

     

    }

     

    }

     

     

    class test_class {

     

    {

     

    "soc1"

     

    "www.soc1.com"

     

    "soc1.com"

     

    }

     

    }
  • Quick question: I presume you're using IE9 here? If that's the case, then follow this tortured logic...

     

     

    Prior to IE9, the way shortname resolution worked is that the browser would look to see if there was a NETBIOS name resolution possible for the shortname (so if you entered "mysite" and there was a NETBIOS name called "MYSITE" it would change the URL to "http://mysite/" and you'd be able to access).

     

     

    IE9 changed this behavior a bit. Now, if you enter a shortname, it'll immediately take you to a searchpage at your default search provider with the shortname as the search term; if there's a NETBIOS name resolution possible for the shortname, it will prompt at the bottom of the search results page "Do you want to go to http://mysite/?". If the user clicks yes, then the browser will load the site from the shortname.

     

     

    Your solution is probably twofold: You might need a NETBIOS name resolution to be put in (either a legacy WINS entry made if you're still using WINS or have it set in DHCP), or you need this particular hostname registered in DNS for the default DNS domain that your users are in (if your users are in "us.company.com" you'd need a record created for "soc1.us.company.com"). Even then, with IE9 the user will still get the searchpage first, followed by the "Did you really want the shortname?" prompt.

     

     

    If you manage your workstations somehow, you can alter this behavior with a registry change. You can set:

     

     

    [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]

     

    "GotoIntranetSiteForSingleWordEntry"=dword:00000001

     

     

    or if you don't manage these machines, you can instruct users to click Internet Options, click the Advanced tab, and check the option "Go to an intranet site for a single word entry in the Address bar". This will basically revert to IE8 behavior.

     

     

    As far as the iRules logic goes for shortname redirection, you're on the right track (although the "page cannot be displayed" probably means your VIP isn't listening).