title: SSL Heroku Dnsimple and security error.
body: <p>I have followed a <a href="https://stackoverflow.com/questions/6701549/heroku-ssl-on-root-domain">previous posting</a> on here on getting these three things working together, but I've become stumped. </p>
  
  <p>I'm getting the following error when visiting www.myapp.com in most browsers. This is chrome's error-</p>
  
  <pre><code>You attempted to reach www.myapp.com, but instead you actually reached a server identifying itself as myapp.com.
  </code></pre>
  
  <p>Obviously, close but not quite what I want.  This is what I get when I run heroku domains-</p>
  
  <pre><code>myapp.com
  secure.myapp.com
  www.myapp.com
  </code></pre>
  
  <p>I have this method in my application controller (base on instruction from the SO answer I linked to)</p>
  
  <pre><code>  def check_domain
      if Rails.env.production? and request.host.downcase != 'myapp.com'
         redirect_to request.protocol + 'myapp.com' + request.fullpath, :status =&gt; 301
      end
    end
  </code></pre>
  
  <p>I'm using dnsimple and I have a CNAME record-</p>
  
  <pre><code>www.myapp.com pointing to running-water6577.herokussl.com
  </code></pre>
  
  <p>I have an ALIAS record-</p>
  
  <pre><code>myapp.com to running-water6577.herokussl.com
  </code></pre>
  
  <p>And a TXT record-</p>
  
  <pre><code>myapp.com to ALIAS for running-water6577.herokussl.com
  </code></pre>
  
  <p>I thought I had takin every measure to ensure all request for www.myapp.com or myapp.com would point to <a href="https://myapp.com" rel="nofollow noreferrer">https://myapp.com</a> but when typing www.myapp.com it resolves to <a href="https://www.myapp.com" rel="nofollow noreferrer">https://www.myapp.com</a> and it throws the above error in chrome and any other browser. I purchased through Rapidssl.</p>
  
  <p>What have I misconfigured? </p>