Disable HTTP and Allow only HTTPSRSS

4 replies

Last post Feb 19, 2020 01:43 AM by Jalpa Panchal

  • Disable HTTP and Allow only HTTPS

    Feb 13, 2020 02:45 PM|vk1097|LINK

    Hi Team,

    I've an issue with url redirection. Currently i have an app devleoped in Python and used IIS to deploy it. Portal works fine with http binding. Network team has configured the domain in such a way that if user enters http://xxx.yyy.net, it will redirect the request host to https.

    A week ago, we got SSL certificate for our domain to make it secure. I recieved pfx certificate from them. Using Server Certificates option, i imported the certificate and binded my website with it.

    Now the issue, website is running only when i have both http and https bindings in it. If i remove http bindings, website stops.

    So i kept both http and https in my binding and to find is the request host url is http or https, i written a log in my python code to track it.

    I found it was only http://xxx.yyy.net and not https://xxx.yyy.net.

    So is there any workaround to make it https and block http. I dont want the website to work on http.

  • Re: Disable HTTP and Allow only HTTPS

    Feb 13, 2020 03:24 PM|lextm|LINK

    vk1097

    If i remove http bindings, website stops.

    Stop in which way? Show it clearly.

    You should not remove HTTP binding either, as people now simply use URL Rewrite module to redirect from HTTP to HTTPS.

    Lex Li
    IIS Consulting Services at https://support.lextudio.com/services/consulting.html
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Disable HTTP and Allow only HTTPS

    Feb 13, 2020 05:58 PM|vk1097|LINK

    Thanks lextm for your reply.

    I have 2 bindings one with http(unassigned):80 and another with https(unassigned):443. When i run my website with any of the url, its working fine. But when i remove http binding and try to run my website, the page doesn’t getting loaded.

    Since I’m using some python libraries for single sign on implantation, i need request url to be https and not http.

    If i have both http and https binding, my python library is getting http request when page loaded.
    So i thought of allowing only https and not http.
  • Re: Disable HTTP and Allow only HTTPS

    Feb 14, 2020 07:44 AM|Jalpa Panchal|LINK

    Hi,

    You cant remove the HTTP binding from the site as lex li suggested. you could use IIS URL rewrite module to redirect the HTTP request to https.

    below is the rule:

    <configuration>
     <system.webServer>
     <rewrite>
     <rules>
     <rule name="HTTPS force" enabled="true" stopProcessing="true">
     <match url="(.*)" />
     <conditions>
     <add input="{HTTPS}" pattern="^OFF$" />
     </conditions>
     <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
     </rule>
     </rules>
     </rewrite>
     </system.webServer>
    </configuration>

    Note:  make sure you installed the URL rewrite Extention. if not you could download it from below link:

    https://www.iis.net/downloads/microsoft/url-rewrite

    you could refer below link on how to configure pfx certificate in iis:

    https://www.trustico.jp/install/import/iis7/iis7-pfx-installation.php

    https://www.digicert.com/kb/ssl-support/pfx-import-export-iis-7.htm

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: Disable HTTP and Allow only HTTPS

    Feb 19, 2020 01:43 AM|Jalpa Panchal|LINK

    Hi,

    Is your issue solved?

    If your issue is solved then I request you to mark the helpful suggestion as an answer. This will help other people who face the same issue.

    If your issue still exists then try to refer the solution given by the community members.

    If then also you have any further questions then let us know about it.

    We will try to provide further suggestions to solve the issue.

    Thanks for your understanding.

    Regards

    Jalpa.

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.