Setting up HTTPS DNS with Namecheap and Heroku - heroku

I know there have been very similar questions asked but both companies changed over time and it's been hard to get a full working solution.
I'd like to have a naked subdomain (mysite.io) but if I have to have www.mysite.io, that's fine too.
So on the heroku dashboard I have :
DOMAIN NAME : mysite.io DNS TARGET : mysite.io.herokudns.com
DOMAIN NAME : www.mysite.io DNS TARGET www.mysite.io.herokudns.com
I know I should probably only have one of those active but I'm not sure which...
Then, on the NameCheap dashboard, I have :
EDIT: I have read what seemed like a good answer, here's what I changed, awaiting to see if it's gonna work.
CNAME Record - www - www.mysite.io.herokudns.com
CNAME Record - # - mysite.io.herokudns.com
And no redirect
I will update if it works
UPDATE :
Using two CNAME records indeed worked fine, except that users can still connect in HTTP and not be redirected to HTTPS. I probably need to add a redirect for that.

If anyone is still having problems and your website opens without HTTPS. There is a line of code in rails applications which you should uncomment. Go to config/environments/production.rb In this file you will find a commented line "config.force_ssl = true". Uncomment this line and your application will always open up with https

Combination of two answers above will solve the problem for Rails applications:
Go to Namecheap and add the two following CNAME's:
Type: CNAME
Host: #
Value: www.yourdomain.com.herokudns.com
TTL: Automatic
Type: CNAME
Host: www
Value: www.yourdomain.com.herokudns.com
TTL: Automatic
And then follow second answer: "Go to config/environments/production.rb In this file you will find a commented line "config.force_ssl = true"."
That should do the trick.

Related

mac custom localhost with port on file host

i have 2 projects running on different ports
localhost:7240
localhost:6040
I would like to have two custom domains like
website.dev -> that points to localhost:7240
admin.dev -> that points to localhost:6040
My host file
127.0.0.1 website.dev
127.0.0.1 admin.dev
and on browser i tryed those
http://website.dev/
http://website.dev:7240/
but none of them worked :/
but if i write
localhost:7240
localhost:6040
will work.
I apprecite any help. Thanks.
OMG !!
I make it work. Follow those rules.
dont user .dev, use something like .local
127.0.0.1 website.local
On chrome disable the https SSL enforcer
chrome://net-internals/#hsts, add the website.local in the Delete domain security policies1
Clear cache or history data
Vistin http://website.local:7240/ Dont forget the / at the end.

Rewrite URLs with CouchDB

I'm building my first CouchApp (a simple blogging engine) in order to learn more about it. Now, I have it working to the point that the following URL returns blog posts:
http://127.0.0.1:5984/couchblog/_design/couchblog/_list/index/posts
I have a view called posts that returns my posts, and a list called index that renders the posts. So I figured my next step was to rewrite the URLs to something a bit friendlier. Unfortunately the documentation on URL rewriting seems a tad vague, and I just can't seem to get anything to work.
The rewrite section of my design document looks like this:
rewrites: [{
from: '../../../',
to: '/_list/index/posts',
method: 'GET',
query: ''
}],
I'd like to rewrite it so that it serves the list of blog posts from the web server root, but I just can't seem to get anywhere with it. Can anyone see what I'm doing wrong? I'm using CouchDB 1.6.0 on OS X Snow Leopard via Homebrew.
I'd like to rewrite it so that it serves the list of blog posts from the web server root
I think you need to configure your vhosts settings in the couchdb config for that. This is covered pretty well in the vhosts section so I will just post the relevant part here:-
To add a virtual host, add a CNAME pointer to the DNS for your domain name. For development and testing, it is sufficient to add an entry in the hosts file, typically /etc/hosts` on Unix-like operating systems:
# CouchDB vhost definitions, refer to local.ini for further details
127.0.0.1 couchdb.local
Test that this is working:
$ ping couchdb.local
PING couchdb.local (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.025 ms
64 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.051 ms
Finally, add an entry to your configuration file in the [vhosts]* section:
[vhosts]
couchdb.local:5984 = /example
*.couchdb.local:5984 = /example
If your CouchDB is listening on the the default HTTP port (80), or is sitting behind a proxy, then you don’t need to specify a port number in the vhost key.
*By the way you can do this from futon as well. Just make sure to restart couchdb after you have configured your vhosts section. Other wise changes will have no effect.
For our case however we need to map the vhosts section to the rewrite handler on our database. So our vhosts will look something like this:-
couchdb.local:5984 = your-db/_design/your-design/_rewrite
Modify your rewirtes handler as well
rewrites: [{
from: 'index',
to: '/_list/index/posts',
method: 'GET',
query: ''
}]
Now if you issue a request to
couchdb.local:5984/index
You should see a list of posts.

Heroku and subdomains

I have the domain ingledow.co.uk. I have recently been working on a Heroku app that is deployed to david.ingledow.uk and this has been done successfully.
However, I now want to redirect all my old domain and subdomains to david.ingledow.co.uk. Here is a list of domains I have that I want to redirect to my new subdomain:
ingledow.co.uk > david.ingledow.co.uk
www.ingledow.co.uk > david.ingledow.co.uk
blog.ingledow.co.uk > david.ingledow.co.uk
I've set CNAMEs to david.ingledow.co.uk. but I get the following error:
Heroku | No such app
There is no app configured at that hostname.
Perhaps the app owner has renamed it, or you mistyped the URL.
Any suggestions would be much appreciated!
If you're setting them as CNAME's then they are not redirects - it would be making your site available on www.ingledow.co.uk, blog.ingledow.co.uk. You'd have to add these all as custom domains to your application and then handle the redirect in your app. Instead you could set them up as redirects so when you go to blog.ingledow.co.uk you get redirected to david.ingledow.co.uk at DNS level.
See https://devcenter.heroku.com/articles/route-53#naked-root-domain for more info.

Domain host records for github and namecheap

I have a custom domain with namecheap that I want to redirect to my github page which is at myuser.github.io.
My host records at namecheap have '#' and 'www' A records with an IP of 192.30.252.153. At the root of my github page (in the repo) I have a cname record with mydomain.com. in the file. When I browse to my custom domain in a web browser I get a message that the github page cannot be found.
Ideas? I found a few blog posts about setup, but none of the options worked for me.
Namecheap has changed things. This is what I did:
This is what is working for me.
In my pages repository, the CNAME is just:
phillipamann.com
I hope that helps.
To support the improved Github Pages, set your records up like this:
HOST NAME IP ADDRESS RECORD TYPE TTL
# 192.30.252.153 A (Address) 1800
www <username>.github.io CNAME (Alias) 1800
Then, fill out one row under SUB-DOMAIN SETTINGS:
HOST NAME IP ADDRESS RECORD TYPE TTL
# 192.30.252.154 A (Address) 1800
More information here: http://davidensinger.com/2013/03/setting-the-dns-for-github-pages-on-namecheap/
What worked for me was the following...
Hostname IP Record Type TTL
# 204.232.175.78 A(Address) 1800
www 204.232.175.78 A(Address) 1800

How to expose heroku app through domain

I have heroku app available at https://myapp.herokuapp.com (I am using SSL endpoint with self signed cert for now)
I have domain mydomain.md also available at https://mydomain.md - with signed cert.
I want to access my heroku app through this domain.
What I have to do to make it work? What I have to set on heroku and on my domain admin panel? I have never done anything with domains and I have no idea what is CNAME/APEX/ALIAS and I dont know what is the type of my domain.
I am trying to make it work... I added subdomain in admin panel: api.mydomain.md.
And I did: heroku domain:add api.mydomain.md
And now I am confused - is it custom domain or it is root domain or what?
I have to add CNAME record in DNS records of mydomain.md or api.mydomain.md?
I tried to add CNAME record in both but it doesnt work...
What should be name of CNAME record - it must be 'www' or it may be anything?
when I type api.mydomain.md in browser it just shows 'under construction' page
you need to point your domain to your heroku app.
here is a super simple documentation about that:
https://devcenter.heroku.com/articles/custom-domains
The CNAME approached has never worked for me either, but this does...
Edit your domain's DNS Zone File
Create the following 3 A (host) records...
First record...
Host = #
Points To = 75.101.145.87
TTL = whatever you wish (ex. 30 mins)
Second record...
Host = #
Points To = 75.101.163.44
TTL = whatever you wish (ex. 30 mins)
Third record...
Host = #
Points To = 174.129.212.2
TTL = whatever you wish (ex. 30 mins)
In the end it should look something like this screenshot. Hope this helps :)

Resources