SharePoint Apps: Blank Page Displayed when Navigating to App

I was trying to get a SharePoint app up and running in our environment but was running into a bit of an oddity.  After clicking on our App’s icon in Site Contents, I was taken to a blank page.  It wasn’t a SharePoint error page.  It wasn’t an IIS error page.  It was just a blank page. I happened to view source, and this is what showed up:

<html><head><META HTTP-EQUIV=”Content-Type” CONTENT=”text/html; charset=utf-8″><meta id=”quot;Robots”” content=”NOINDEX ” /></head><body></body>
                <script type=”text/javascript”>
                 var gearPage = document.getElementById(‘GearPage’);
                 if(null != gearPage)
                     document.title = “Error”;

At this point I was even more confused.  I thought it was something our company had done, because our logo is a series of gears and there is a section of JavaScript looking for an element called GearPage, but it turns out this is entirely from SharePoint – I have no idea what it is or what it’s trying to do, but it is from SharePoint.  Another oddity is that I was getting this error when navigating to the App using HTTPS, but when I changed the protocol to HTTPS the app showed up just fine. 

Solution … at least for one protocol

In order to access the app web, you have to be running the same protocol used in the default URL of your web application.  In my case, I was accessing the App from a zone that used HTTPS.  However, the default URL for the web application was using HTTP.  As such, SharePoint threw up this friendly error page with nothing on it but some random JavaScript gibberish.  When I switched my default URL to use HTTPS instead of HTTP, I was able to click on the App icon and have it launch correctly.

Of course, I now have the same problem accessing the app web from HTTP, but since we mostly work in the HTTPS world this is “working” for me.  I’m not sure at this point in time if there is a way to access it using both protocols.