0

I am attempting to set up a blog using Ghost hosted on Windows Azure.

I have deployed and get everything set up using the pre-configured repo created by AzureWebApps on GitHub.

Everything is worked as expected and I have configured records on my own domain name which are working as you navigate to the site.

The issue I have is that the *.azurewebsites.net domain name appears in search engine results and when you navigate (for example, to www.mysite.com/rss) it switches out the custom domain name and replaces it with the builtin azurewebsites one.

looking at the web.config, there are two rewrite rules

<rules>
    <rule name="StaticContent">
      <action type="Rewrite" url="public{REQUEST_URI}"/>
    </rule>
    <rule name="DynamicContent">
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
      </conditions>
      <action type="Rewrite" url="index.js"/>
    </rule>
</rules>

I found a chap named Gareth had done a post about a rewrite rule that will "block" the *.azurewebsites.net domain, and I put this rule into the rule set above the default two, and this got me almost there. The rss link now works.

The issue now arises when I navigate to www.mysite.com/ghost (which is the admin page, on https) it complains that there are too many rewrite rules.

I can see why this is the case, but I can't figure out a combination of rules to satisfy launching the webapp with the custom domain and being able to navigate to other pages within the site. I'm pretty sure it's something obvious.

lookitskris
  • 678
  • 1
  • 6
  • 23
  • Do you create a CNAME record on DNS to bind the azure domain `*.azurewebsites.net`? Do you set up the `Custom Domains and SSL` at the `All settings` of Azure new poral (please refer to https://azure.microsoft.com/en-us/documentation/articles/web-sites-custom-domain-name/#enable-the-domain-name-on-your-web-app)? Do you modify the `websiteUrl` using the custom domain in the `config.js` file (see https://github.com/AzureWebApps/Ghost-Azure/blob/master/config.js) of Ghost-Azure? – Peter Pan Jan 18 '16 at 09:39

1 Answers1

0

Based on my understanding, I think you had create a CNAME record to bind your custom domain name with the Azure website domain name. However, I don't know whether you set up the Custom Domains and SSL at the All settings of your Azure WebApp on the new portal. As reference, you can refer to https://azure.microsoft.com/en-us/documentation/articles/web-sites-custom-domain-name/#enable-the-domain-name-on-your-web-app to be sure.

According to the url rewrite rule from Gareth's article, It seems to works fine for all urls. I think the issue might be caused by the code self that render the urls using the configure variables like the websiteUrl in the config.js file of Ghost blog, see https://github.com/AzureWebApps/Ghost-Azure/blob/master/config.js.

Hope it helps, and waiting for your feedback. Any concern, please feel free to let me know.

Peter Pan
  • 23,476
  • 4
  • 25
  • 43
  • I edited the code in config.js to just point to "www.mysite.com" and now everything works (without the need for the extra rule in web.config). The only issue is when I navigate to to the admin portal (which is SSL) I get a connection is not private error - but I can proceed and it works. This is a small niggle but it's a large step in the right direction - thanks! – lookitskris Jan 18 '16 at 21:53