Scalable way to add third-level domains - fortrabbit

Users of my app has an ability be get a third-level domain for them : my-domain.example.com. What is the scalable way to manage that on Fortrabbit?
I use CloudFlare for DNS management. I assume I can delegate domains via API with them. How can I automate it on a Fortrabbit side for that domain to resolve?

On fortrabbit, you probably don't have to use an API or something.
Just create a domain entry *.example.com that points to your document root. You will have to get the subdomain in your code.

Related

Accessing an app via heroku domain when it's set to a custom domain

I have an app with a custom domain that I'm letting retire.
I'd like to keep the custom domain until it expires but give people the ability to access the app via the heroku domain already so they can get used to it, but when I go to the address specified in my app, it says no app is found.
Is it invisible because of the custom domain? Is there another way to expose the heroku domain to the world?
Thanks in advance :)

How to serve mulitple web applications on different subdomains?

Not sure if the title is well suited but I am having three apps (static content) at the moment:
public
app
admin
public is just content which is just for the regular web, app is content which is rendered for mobile devices and admin is basically a tool for administrative stuff. They are all contained in the same Spring Boot application and talk to the REST API at example.com/api. Technically, I could just place them into resources/static such that
resources/static/public
resources/static/admin
resources/static/app
which would allow me to access the apps as such:
example.com/public/index.html
example.com/admin/index.html
example.com/app/index.html
However, my goal is to have the following structure:
example.com // For public
admin.example.com // For admin
app.example.com // For app
example.com/api // REST API
How can this be achieved or what can I do to make this possible?
It sounds like you have three systems: public, admin and app sharing a common REST api. Probably the best approach would be to serve the static resources for each of the three systems using a content delivery network (CDN) like AWS CloudFront or Google Cloud CDN.
Another approach, though less desirable, would be to use a proxy to redirect app requests (for example https://admin.example.com to https://internal-spring-boot-server/admin). You could use Apache mod_proxy with reverse proxy (see https://httpd.apache.org/docs/2.4/mod/mod_proxy.html), or NGNX reverse proxy https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/
I think that there are two ways to achieve what you are trying to do you.
Either you will configure your subdomains in your DNS plesk/cpanel/.. to look a specific Document root (The path to the each of your apps home directory.)
for example when someone asks for example.com the request would ask for example.com/main, when someone asks for admin.example.com the request would ask for admin.example.com/admin etc. In this way, you essentially ignoring the subdomain in your Spring app and you manipulate the routes in the #Controller level using the RequestMapping values main/admin/etc..
Alternatively if you don't want to mess with the Provider's control panel, you could follow the steps of this answer. But then you'd have to implement these three custom RequestCondition classes and it may not be the most simple way to go.
Not the best documented answer but I hope I pointed you to the right direction.

Pointing domain to Heroku application with wildcard

I have an application where users get their own subdomain, like site1.mysite.example. I would like to allow users to register a custom domain that they can point to to their sub domain but I'm having trouble figuring how to configure Heroku and my DNS settings to allow this.
In my DNS settings for my domain I have a CNAME record setup like so:
Host = *
Value = sites.mysite.example
The value here is an app I have running which will translate the subdomain (site1.mysite.example) to figure out which site to load.
I have a CNAME for mysite.com which points to Heroku's DNS site:
Host = sites.mysite.example
Value = mysite.example.herokudns.com
On the domain I'm testing with I have a CNAME record setup like this:
Host = docs.othersite.example
Value = site1.mysite.example - this is the subdomain they get on my site
But for some reason this is not working. If I register site1.mysite.example as the custom domain in my application and I run dig site1.mysite.example I get the following:
;; ANSWER SECTION:
docs.othersite.example IN CNAME site1.mysite.example
site1.mysite.example IN CNAME sites.mysite.example
sites.mysite.example IN CNAME mysite.example.herokudns.com.
When I try docs.othersite.example in a browser I get Heroku's There's nothing here, yet. page. So it seems like Heroku is not loading up my application. I am guessing this is because I do not have docs.othersite.example registered as a domain in my Heroku application, but I do not want to have to register every custom domain. Also, I do not own these domains so I could not anyway.
What am I doing wrong here? Any help is much appreciated. I'm happy to post any more info someone needs or clarify anything.
Heroku does support wildcard domains, so in this case you could add *.othersite.example to your Heorku app's custom domains.
If you need to support different root domains (othersite2.example, othersite3.example) for each user, there's no easy way to support that. You'd need use Heroku's Platform API to programmatically manage custom domains.

Providing customers with domain aliasing

Currently I have an app which gives my users a custom subdomain.
neat.coolapp.com
However, I want my users to be able to CNAME their personal domain to that website.
ex. hey.neat.com -> neat.coolapp.com
Is this possible on heroku?
Thanks in advance for any insight.
You'll need to add whatever domain the customer wants to use to your application so the correct application on Heroku responds - you could do this either manually (via the heroku control panel) or use the heroku gem within your application to add the domain to your application via some kind of control panel if the customer is able to add their own domains.
In regards to cname's - I would suggest setting up something like proxy.yourwebsite.com as a CNAME to yourapp.heroku.com and then you get your customers to cname their domain to proxy.yourwebsite.com in their DNS config.
When you sign up for Heroku you will get a subdomain like
asdf.heroku.com
If you have a domain like mywebsite.com you can cname mywebsite.com to asdf.heroku.com and you will need to add mywebsite.com to Heroku's custom domain command.
From there I'm not sure, if you wanted to add mywebsite2.com without having to add it using the custom domain command you can try to cname it to mywebsite.com, if you have two domains you can try it out.

WebsitePanel: Programmatically add/remove domains alias

I need to implement a way to integrate my code so that I could add and remove domain aliases for a single site in WebsitePanel.
I have tried to check WebsitePanel's API, but it seems to be very limited and doesn't allow any management of sites and their domains.
Any ideas how I could do it in some other way?
I was thinking about adding domain alias directly to the site configured in the IIS (7), but I might need to add mail accounts and manage the DNS of the domain alias in the future so it doesn't seem like a good idea.
I have the same issue: I'm trying the 'wget' approach. Login can be done using Default.aspx?pid=Login&user=USER&password=PWD
Then go to the Domain area for each client, and post some data (seems to be the same for each client/domain, can be easily read from the form/input id), to get to the DNS management web.
It's way late, and it's not just "do this", but hey, it is a starting point until something better appears.

Resources