Kategoriarkiv: sharepoint2016

Http to Https Redirect in Provider Hosted Apps

It is strongly recommended to use https in SharePoint Provider Hosted Apps. In many provider hosted apps I have seen, only https works. I would recommend to configure a simple http to https redirect in IIS and make solutions better. Many Provider Hosted Apps can be done in that way that they are available without SharePoint Context, e.g. for browsing information. In that case that is important to have an easy url and an automatic http -> https redirect.

In this post I’ll give a short manual for doing that. I would recommend this step for all provider hosted apps.

1. In the Provider Hosted Apps Server install the URL Rewrite IIS Module using Web Platform Installer:


2. Next step is to add the http binding to your solution (this is needed for the future redirect):


Then you can configure the automatic http to https redirect using the GUI or the web.config update. My instructions originally come from JPPInto.com blog.

I suggest updating the web.config file directly in the Provider Hosted App:


3. Add this section to the web.config file:


It is important to know that his web.config section will cause failure on the server if URL Rewrite module is not installed.


These steps are very easy to accomplish and I recommend it for every Provider Hosted App, especially those ones that are accessible without going through SharePoint (Web Content -> Apps). This also reflects the configurations in Azure Apps (WebSites).