How to Provision APIs on Heroku - heroku

Please forgive my question. I am a complete newbie at this.
I have built an API in spring boot and I have pushed it to heroku.
I have a custom domain for my website already as www.mywebsite.com
I want to provision my apis under this domain as well as api.mywebsite.com
How can I achieve this on heroku?
Any help on how to go about this would be sincerely appreciated.
Thanks

I will assume that you have full access to the Namecheap account.
You have 2 options:
A. Use Heroku CLI
B. Use Heroku interface (Web application)
A) Let's go through the process with Heroku CLI.
Make sure that you have the Heroku CLI installed (macOS: brew install heroku, Ubuntu: apt install heroku, etc.)
Add your domain using the command heroku domains:add api.website.com (if you have multiple apps, don't forget at the end of the command to add --app name-of-your-heroku-app.
Heroku will generate for you a DNS target for the custom domain you added at step 2. Run heroku domains and copy the DNS target (The DNS target looks like this: whispering-willow-5678.herokudns.com)
Open your Namecheap domain settings and add a CNAME (Name: "api" and Target: the DNS target provided by Heroku).
Wait few minutes up to few hours.
B) If you want to use Heroku Interface / Webapplications.
Open your app on www.herokuapp.com
Go to "Settings" tab
Scroll down to "Domains"
Click on "Add domains"
Add your subdomain (api.website.com)
Heroku will generate for you a DNS Target
Navigate to your domain settings in Namecheap and create a new CNAME using your subdomain (e.g. api) as name and the DNS target provided by Heroku as target.
You can find all the details in Custom Domain Names for Apps Heroku Documentation

Related

GoDaddy domain not pointing to Heroku app

I'm trying to point my GoDaddy domain to Heroku app. I followed the steps given here: https://devcenter.heroku.com/articles/custom-domains#add-a-custom-root-domain but I'm unable to access my Heroku app. Here are my DNS records settings:
Can someone tell me where I'm going wrong?
cname only allow you to point subdomain, so this case you should be able to see www subdomain pointed to Heroku, can you try to remove the A record.
I would recommend using DNS service like DNSimple/Cloudflare or in case you don't want to go out of Heroku you can try pointDNS

How to customize the domain name of godaddy in heroku app

I have successfully added my domain name of go daddy into my Heroku app .. but DNS target is getting something else . I have changed target in go daddy but still It is not showing the correct one . please help me out
Please read the Heroku doc on custom domain names.
Make sure you've done all of the steps below, and remember there can be a delay before DNS changes are noticeable.
Confirm that you own the custom domain name.
You can buy a custom domain name with a domain registration service.
Add the custom domain to your app with the heroku domains:add
command.
Look up the Heroku-supplied DNS target for the custom domain using
the heroku domains command.
Configure your app’s DNS provider to point to the Heroku-supplied
DNS target.
Confirm that your app is accessible via the custom domain.
There might be a delay while DNS changes propagate.

Configure CNAME for a heroku app with subdomains

Currently i have an app on Heroku with a wildcard subdomain working like this:
client1.myapp.com, client2.myapp.com, ...
This is working fine.
Then, i'd like that each client can access this apps using their own personal domains. So, testing this on my personal domain, i would like to configure test.mydomain.com like this:
CNAME test --- client1.myapp.com
But, this is not working yet. I keep getting the heroku error 'No such app, There's nothing here, yet.'.
Not sure what i am missing. Is it a problem related to my actual Laravel app? Heroku config? DNS?
Thanks in advance for any help.
Assuming your application will provide an hostname for each client (actually, it would probably be preferable to have a single hostname as in any case it looks like they will all point to the same Heroku app), then you have to complete all these tasks in order to make it work:
Add the subdomain client1.myapp.com as domain attached to the Heroku app
Configure the DNS record for client1.myapp.com
Ensure client1.myapp.com resolves (dig client1.myapp.com)
Add the customer subdomain/domain to your Heroku app, otherwise Heroku will reject routing the requests for that domain
Configure the DNS record for the customer subdomain/domain to CNAME client1.myapp.com
Ensure the customer subdomain/domain resolves
According to your issue description, I assume you probably did not configure the customer subdomain/domain as domain to your Heroku app.

DNS routing not working on Heroku app

I'm trying to setup a custom domain for my Heroku Cedar stack app, but it's not working.
I've tried entering 'host www.mydomain.com' command' in Terminal, but it yields no output.
I've already changed my DNS settings and added a 'CNAME' host: www, direct to: my domain.herokuapp.com but still it's not working.
What could I be doing wrong here???
Thanks,
Faisal
The fact that you're not getting any results in terminal for host then the problem lies with your DNS settings - it sometimes takes a while for updates to propogate across the internet, I usually allow for 24 hrs to be sure. If it still doesn't work then you should get in touch with your DNS host.
You also have to add domain entries to your Heroku app:
heroku domains:add yourdomain --app yourapp
The "-app yourapp" is not required if you are in the root directory of your Rails app.
You can repeatedly add more than one domain to your Heroku app.
Here is an article about adding custom domains and DNS setup, at the Heroku Dev Center:
https://devcenter.heroku.com/articles/custom-domains

Use Heroku with register.com

I have a free app hosted on Heroku, and a domain on register.com. How can I connect the two? I am OK with using any service or addon, as long as it is free. The only stipulation is that I can not spend ANY money. I also want to be able to have an m subdomain for a mobile site. Thanks
Follow the instructions to configure custom domains.
You just need to install the free custom_domains addon.
$ heroku addons:add custom_domains
Then add the domains
$ heroku domains:add www.example.com
Then, don't forget to update the DNS settings on your domain provider to point to Heroku IP.

Resources