none
IIS7 or IIS8 http to https redirects

    Question

  • Scenario:

    1 Windows server 2008R2 or 2012std on LAN behind gateway.
    1 external IP (If there where 2 I could use that to separate the requests)
    1 domain
    If I would like to make 2 sub-sites on the IIS and then from the outside(WAN) make it possible to via "http://subsite1.server.com" access the index-page on sub-site1 with https on the IIS and then via "http://subsite2.server.com" access the index-page on sub-site2 with https..

    How do I manage this easiest?

    //CrickaZ


    • Edited by CrickaZ Friday, January 25, 2013 7:57 AM
    Friday, January 25, 2013 7:57 AM

Answers

  • Hi,

    Its by host header. I would try to describe what happens maybe its clear by you.

    When you connect to a website, remote.contoso.com or mail.contoso.com first there will be a dns lookup and receive the ip address from router / firewall probably. Because this is a web request port 80 (http) for default or 443 if it is a secure (https). Your router / firewall is configured to accept these ports and route it to your SBS server.

    When the request is coming to the SBS server IIS will accept the request. IIS has several web sites configured and in the bindings of the different websites there are ip addresses, ports and host headers configured so IIS checks the request, so the ip address and port are the same it will check the host header (remote.contoso.com and mail.contoso.com) and will transfer the request to the right site.


    Regards Ronny
    -------------
    Visit my Blog or follow me on Twitter

    • Marked as answer by CrickaZ Saturday, February 02, 2013 10:10 AM
    Friday, February 01, 2013 6:48 PM

All replies

  • Hi,

    First to start with as I read your question you are not talking about a SBS server so it would be better to post the question in a windows server or iis forum.

    But to answer your question, you could just create two different website in IIS and put a host header on both site to differ these two. 


    Regards Ronny
    -------------
    Visit my Blog or follow me on Twitter

    Friday, January 25, 2013 8:19 AM
  • Hi,

    First to start with as I read your question you are not talking about a SBS server so it would be better to post the question in a windows server or iis forum.

    But to answer your question, you could just create two different website in IIS and put a host header on both site to differ these two. 


    Regards Ronny
    -------------
    Visit my Blog or follow me on Twitter

    Hi Ronny.

    I did not find the IIS forum so I posted it knowingly in the wrong forum. :-O
    If i instead of an dns name make the request via IP, would that still work with the host headers pointing same IP to different sub-sites?

    Regards / Christer

    Friday, January 25, 2013 3:40 PM
  • Hi,

    IIS forums can be found here: http://forums.iis.net/

    no you cannot differ on ip address because this is Always the same because you only have 1 ip address or you have to differ on port number, one site on port 80 and the second on 81 or something you choose. But if you differ from default port you need to give the port number in your site name, like: http://1.2.3.4:81


    Regards Ronny
    -------------
    Visit my Blog or follow me on Twitter

    Friday, January 25, 2013 6:45 PM
  • Hi,

    IIS forums can be found here: http://forums.iis.net/

    no you cannot differ on ip address because this is Always the same because you only have 1 ip address or you have to differ on port number, one site on port 80 and the second on 81 or something you choose. But if you differ from default port you need to give the port number in your site name, like: http://1.2.3.4:81


    Regards Ronny
    -------------
    Visit my Blog or follow me on Twitter

    If I am not totally misstaken when I type for example www.google.se the dns-servers translate that to an IP and then the destination is reached.. If I am correct about that I wonder how I via typing www.sub1.google.se or www.sub2.google.se can reach different sites on one servers IIS if they both translate to same IP?
    Detailed answer on this is really appreciated. :)

    Regards //Chricka

    Friday, January 25, 2013 9:11 PM
  • Hi,

    Please post in the right forum:

     http://forums.iis.net/

    In addition, also refer to the below article:

    Automatically Redirect HTTP requests to HTTPS on IIS 7

    http://www.jppinto.com/2009/04/automatically-redirect-http-requests-to-https-iis-7/

    Regards,

    Yan Li


    Cataleya Li
    TechNet Community Support

    Tuesday, January 29, 2013 8:16 AM
    Moderator
  • Hi,

    Please post in the right forum:

     http://forums.iis.net/

    In addition, also refer to the below article:

    Automatically Redirect HTTP requests to HTTPS on IIS 7

    http://www.jppinto.com/2009/04/automatically-redirect-http-requests-to-https-iis-7/

    Regards,

    Yan Li


    Cataleya Li
    TechNet Community Support

    Possible to move the thread? Or must I post the same Question again in the right forum?

    Regards / Cricka

    Thursday, January 31, 2013 11:09 PM
  • Hi,

    Please post in the right forum:

     http://forums.iis.net/

    In addition, also refer to the below article:

    Automatically Redirect HTTP requests to HTTPS on IIS 7

    http://www.jppinto.com/2009/04/automatically-redirect-http-requests-to-https-iis-7/

    Regards,

    Yan Li


    Cataleya Li
    TechNet Community Support

    The link above only explains how to do make one site in IIS redirect all http request to https. There is nothing about how 2 dns-pointers pointing to the exact same external IP behind the firewall redirect from http to https on different sites in the IIS..

    Regards / Cricka

    Thursday, January 31, 2013 11:15 PM
  • Hi,

    This thread could not be moved to IIS forum, please repost it there.

    Regards,

    Yan Li


    Cataleya Li
    TechNet Community Support

    Friday, February 01, 2013 1:27 AM
    Moderator
  • As said before, if you would like to make a difference on site name you have to create two site and configure a host header for both sites.

    See this post on how to configure host headers http://technet.microsoft.com/nl-nl/library/cc753195(v=ws.10).aspx


    Regards Ronny
    -------------
    Visit my Blog or follow me on Twitter

    Friday, February 01, 2013 7:57 AM
  • As said before, if you would like to make a difference on site name you have to create two site and configure a host header for both sites.

    See this post on how to configure host headers http://technet.microsoft.com/nl-nl/library/cc753195(v=ws.10).aspx


    Regards Ronny
    -------------
    Visit my Blog or follow me on Twitter

    Ok Ronny.
    My question though is a little deeper than that .. I will try too specify better..
    Obviously in a system like this there is a firewall/gateway between internet and the server so what I would like to know is how the request from wan brings the information through the firewall so the IIS knows which site is adressed if both remote.contoso.com and mail.contoso.com are A-records pointing to exactly the same IP ?

    Regards / Cricka

    Friday, February 01, 2013 4:00 PM
  • Hi,

    Its by host header. I would try to describe what happens maybe its clear by you.

    When you connect to a website, remote.contoso.com or mail.contoso.com first there will be a dns lookup and receive the ip address from router / firewall probably. Because this is a web request port 80 (http) for default or 443 if it is a secure (https). Your router / firewall is configured to accept these ports and route it to your SBS server.

    When the request is coming to the SBS server IIS will accept the request. IIS has several web sites configured and in the bindings of the different websites there are ip addresses, ports and host headers configured so IIS checks the request, so the ip address and port are the same it will check the host header (remote.contoso.com and mail.contoso.com) and will transfer the request to the right site.


    Regards Ronny
    -------------
    Visit my Blog or follow me on Twitter

    • Marked as answer by CrickaZ Saturday, February 02, 2013 10:10 AM
    Friday, February 01, 2013 6:48 PM
  • Hi,

    Its by host header. I would try to describe what happens maybe its clear by you.

    When you connect to a website, remote.contoso.com or mail.contoso.com first there will be a dns lookup and receive the ip address from router / firewall probably. Because this is a web request port 80 (http) for default or 443 if it is a secure (https). Your router / firewall is configured to accept these ports and route it to your SBS server.

    When the request is coming to the SBS server IIS will accept the request. IIS has several web sites configured and in the bindings of the different websites there are ip addresses, ports and host headers configured so IIS checks the request, so the ip address and port are the same it will check the host header (remote.contoso.com and mail.contoso.com) and will transfer the request to the right site.


    Regards Ronny
    -------------
    Visit my Blog or follow me on Twitter


    Thank you Ronny!!
    Exactly what I was asking for and now it is totally clear.
    I did not know that the host header was checked by the IIS but now when I know it is all clear :)
    Tnx!! / Cricka
    Saturday, February 02, 2013 10:10 AM