Is it possible to use google domains to forward a subdomain masked with a port and have that masked? - url-masking

Suppose I own example.com and I have several services I want to expose to the internet. I'd like to create a subdomain devil.example.com and point it to http://example.com:6666. I can do this right now using Google's subdomain forward feature however, it shows http://example.com:6666 in the address bar when I want it to show http://devil.example.com Is there a way of accomplishing this on Google domains?

Related

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.

Point URL to different IP, A record

Example
Let's say we have a domain www.example.com.
This domain points to Heroku and we have functional website.
example.herokuapp.com
www.example.com
When we load the website
www.example.com
our website works and succesfully loading App on Heroku. Let's say it is running a Django framework (Python Environment)
There is another website that has different IP and is built in Ruby Rails for example and is running on different host provider.
If we load the website www.example.com, we are on the homepage, we can easily browse different pages like about, photos, videos etc.
Is there a possibility if I type
www.example.com/store/
that it would load that ruby rails website?
Let's remove possibilty moving the app from different provider to heroku or any other provider that www.example.com is on (or precisly were example.com points to in DNS).
Is it possible to map it somehow or point it in DNS to make it work like that?
Short answer: no.
Longer answer, you could use a 301 redirect from /store/ to the other site, or a subdomain, like store.example.com. For more information, read up on DNS A records, as you suspected! Good luck!

Scalable way to add third-level domains

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.

How does custom user URLs work?

Today, I'm asking a question out of curiosity.
The new sites, I'm talking about.. Tumblr, Pinterest and many more are giving their users custom URLs to their sites, for example, mine on Tumblr would be maurocasas.tumblr.com instead of tumblr.com/maurocasas, as Facebook does.
My question is how do you handle this URLs? I'm curious. Some sites also let you point your own domain to your blog/site, so I could direct maurocasas.com to my Tumblr.
How do they do this? I'm curious.
Thanks!
It's pretty simple, as long as you have control over the DNS configuration of your domain. Just set up a wildcard subdomain pointing to your webserver, and then just parse the subdomain part of the hostname of the incoming request and use it as the username. You might have to configure your webserver as well to support it.

Resources