Domain setup on DreamHost to Heroku - heroku

I am moving my rails applications form DreamHost to Heroku.
Name servers are still on DreamHost.
Here's how I set up:
www.mydomain.com: CNAME to mydomain.herokuapp.com
mydomain.com redirected to www.mydomain.com
This sort of works.
But mydomain.com/admin doesn't work.
I must go to www.mydomain.com/admin.
How can I make mydomain.com/admin work?
Thanks.

mydomain.com is forwarded to www.mydomain.com correct? Then mydomain.com/admin wont work, everything mydomain.com is forwarded.
If you want this behavior then you need to remove your forwarding at the DNS and do this kind of redirection (or not) at the application level.

Related

HTTPS not working for domain, but works for subdomain

I've got a subdomain set up for my nextcloud instance at nc.example.com, and I have set up a new virtual host for my main website that I will look at creating at example.com. I ran certbot on example.com, and initially it worked, then I accidentally ran certbot again, but ctrl C'd out of it, but now HTTPS on example.com does not seem to work, even though when I run certbox certificates, it's listed there.
Initially example.com would work, but now it will only work when I include www., but it's running on a HTTP connection.
My nc.example.com works fine with HTTPS and no www., in my DNS records I've added an A record pointing to 174.129.25.170 to fix the naked domain issue with having to include www., but as I mentioned, it was working briefly and now it's not.
A Record Entry
I feel like I've just messed something simple up cause it was working initially. Any assistance would be appreciated because I'm still learning this stuff. I'm running apache2 on an Ubuntu 22.04 AWS EC2 instance.
Cheers
My apologies, I fixed this literally 3 minutes after posting this.
I ran sudo certbot
and it asked which names I'd like to activate HTTPS for, it listed three domains
example.com
nc.example.com
www.example.com
I selected 3, and it seems to have fixed my problem, but now I have 3 certificates, will this matter?

Heroku's domain mysite.herokuapp.com displays in browser after domain forwarding

Just bought a new domain on https://iwantmyname.com/. For the purpose of this post lets assume the domain is example.fm
I set up domain forwarding where I got example.fm to point to example.herokuapp.com. Everything seems to work, but after the site is forwarded, the browsers textbox displays the old example.herokuapp.com domain instead of example.fm
I already added example.fm to heroku with heroku domains:add example.fm, but that didn't seem to change anything.
Any thoughts?
So the people at iwantmyname.com have been extremely helpful.
It turns out that I only did URL forwarding, which isn't the recommended way of setting up a domain through them.
They have a specific system with dealing with heroku here: mysite.herokuapp.com
I got rid of the forwarding and set up my domain completely through Heroku custom domain DNS setup.

Getting the domain name into an EC2 URL

This is probably an incredibly simple question, but I haven't been able to find out what specifically I'm doing wrong here.
I have a site hosted on Amazon EC2, a domain name registered with GoDaddy, and Route 53 nameservers. Let's call the site domain.com...
I've set everything up with:
The GoDaddy nameserver fields set to the Route 53 nameservers
A hosted zone for domain.com on Route 53
In this hosted zone, a record set
In this record set, two A Records for "domain.com" and "www.domain.com", both of which point to the Elastic IP of my EC2 server
This works, and when I go to domain.com, I get redirected to my site. However, the url does not get labeled as "domain.com/index.php" but instead as "ec2-XX-XXX-XXX-XXX.compute-1.amazonaws.com/index.php".
What am I missing here?
As a PS, I just want to temporarily have domain.com route correctly -- I don't care about static IP at this point.
The setup is correct. You have something in your application that is redirecting requests. Wordpress will redirect to the domain it was installed on, other application do the same thing. To fix you may have to update options in the database or in a config file.

heroku and domain name conventions

(tried on Server fault, so going to try here)
Hi I recently setup my octopress blog at http://davidmjohnson.me. This domain works fine, but when I try http://www.davidmjohnson.me I get a "heroku no app found." Why is the www not working. Would really appreciate an explanation. I bought my domain name at dnsimple. Do I need to add a redirect from "http://www.dav..." to just "http://dav..." ?
Thanks
I'm guessing you need to configure this domain (and any subdomain) in the heroku CLI application (equiv. of ssh-ing into the machine and changing the nginx/apache location/virtualhost configuration).
I see they have an entry about this in their reference:
https://devcenter.heroku.com/articles/custom-domains
To elaborate a bit from the documentation:
Subdomains ( www.mydomain.com)
For each subdomain you want to setup configure your DNS provider using
a CNAME record pointing the subdomain to the applicable Heroku
hostname.
If the app is on Cedar, then CNAME the subdomain to myapp.herokuapp.com
If Bamboo, then myapp.heroku.com
In DNSimple a CNAME
record entry for a Cedar app would look like:
You can confirm that your DNS is configured correctly with the host
command:
$ host www.example.com
www.example.com is an alias for myapp.herokuapp.com.
myapp.herokuapp.com is an alias for ar.herokuapp.com.
ar.herokuapp.com is an alias for argon-stack-1879049447.us-east-1.elb.amazonaws.com.
argon-stack-1879049447.us-east-1.elb.amazonaws.com has address 107.20.157.144
...
Actually, it should really be the other way around. It is much better practice to point CNAMEs at Heroku apps, since Heroku apps have no real "static" IP. Since naked domains need an A-record, pointing a naked domain to a Heroku app makes everything much less stable. So the best practice is to forward your naked domain to a "www" subdomain, and then point the "www" CNAME to your Heroku app.
Heroku goes into detail about this here.

naked domain heroku with Zerigo

Hello there here is my problem.
I've a domain example.com and example.herokuapp.com. It is not recommended by the website to install A records pointing to heroku and this makes the naked domains not possible, so I'm forced to use www.example.com instead of example.com.
I've seen on internet that this is actually possible to do, so far I heard of Zerigo.
Do you have any workaround to that?
Thanks,
n
Yes, you either need to point your A-records for example.com at the Heroku Ips, or better still use DNSimple's ALIAS to do it with a CNAME.
More info here: https://devcenter.heroku.com/articles/avoiding-naked-domains-dns-arecords

Resources