locked
HTTP redirects on an App Service. RRS feed

  • Question

  • I currently have an App Service where we want to force the usage of HTTPS. I've seen several explanations about a web.config file, but I haven't been able to find it. The site is mainly built with HTML, JAVASCRIPT and PHP.

    The site itself has been uploaded on an FTP Location that's part of the App Service. Could I configure the forwarding there?

    Wednesday, August 9, 2017 12:28 PM

Answers

  • If it is a blank website there will be no web.config file, you should create it yourself under the wwwroot.

    You can try using web app extension without creating a webconfig as below https://www.siteextensions.net/packages/RedirectHttpToHttps/

    Check the below links for more information
    https://blog.nicholasrogoff.com/2017/01/12/azure-app-service-force-redirect-from-http-to-https-the-easy-way/

    https://stackoverflow.com/questions/39244265/azure-web-app-redirect-http-to-https

    Disclaimer:
    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet. 

    ------------------------------------------------------------------------------------------------------------------

    Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.




    • Edited by Sheethal J S Monday, August 14, 2017 9:17 AM
    • Proposed as answer by Nazre1 Monday, August 14, 2017 9:30 AM
    • Marked as answer by TimOomis Monday, August 14, 2017 2:04 PM
    Monday, August 14, 2017 9:15 AM

All replies

  • You could find web.config file under the site location D:\home\site\wwwroot using Kudu Console.

    To access KUDU console, navigate to https://{yoursitename}.scm.azurewebsites.net -> Debug Console-> CMD/PowerShell -> navigate to the wwwroot folder (D:\home\site\wwwroot>).

    Refer File structure on azure to know more about files and directories on Azure WebApp.

    You may also use App Service Editor or Azure Resource Explorer to edit/modify web app files. App Service Editor provides an in-browser editing experience for your App code.

    You may want to check the article HTTPS only on Azure App Service Web Apps for redirecting to https.

    -----------------------------------------------------------------------------------------------
    Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.

    Wednesday, August 9, 2017 4:50 PM
  • There doesn't seem to be a web.config file, how could I create one that would function correctly for an HTML website (non ASP)
    Monday, August 14, 2017 6:42 AM
  • If it is a blank website there will be no web.config file, you should create it yourself under the wwwroot.

    You can try using web app extension without creating a webconfig as below https://www.siteextensions.net/packages/RedirectHttpToHttps/

    Check the below links for more information
    https://blog.nicholasrogoff.com/2017/01/12/azure-app-service-force-redirect-from-http-to-https-the-easy-way/

    https://stackoverflow.com/questions/39244265/azure-web-app-redirect-http-to-https

    Disclaimer:
    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet. 

    ------------------------------------------------------------------------------------------------------------------

    Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.




    • Edited by Sheethal J S Monday, August 14, 2017 9:17 AM
    • Proposed as answer by Nazre1 Monday, August 14, 2017 9:30 AM
    • Marked as answer by TimOomis Monday, August 14, 2017 2:04 PM
    Monday, August 14, 2017 9:15 AM
  • Thanks, I was not keen on using the extension but was unable to create a working web.config file. 

    In the end the extension works great :)

    Monday, August 14, 2017 2:05 PM