Custom Subdomain with CNAME Problem - dns

I am having a bit of a struggle grasping how to use custom domains with my app. Its the common case of having an app that assigns users to subdomains, ex. user.theapp.com and they want to use a CNAME so m.theirsite.com resolves to the application. It seems that most services that do this require you to tell them what your custom domain is, and that just adding a CNAME record doesn't work. Steps:
User creates an account.
We tell them they can make a CNAME entry to yourstuff.theapp.com (which is the current location).
This is my confusion. After 1&2 my custom domain still isnt working.. so once the client makes that CNAME record and provides us with "m.theirsite.com", what special magic do we do with it to make those sites "the same"?
Thank you in advance.

Our solution was to use PHP/MySQL to solve this. As normal, you should have the external domain/subdomain CNAME'd to your app, however as you will see, the CNAME entry doesn't need to be to the exact subdomain on the app. Next, you will build an area into your database where a user can tell you what external site they have CNAME'd from. At this point, you will perform most of your authentication on the website based on the HTTP host, either grabbing the subdomain and using it as a client, or checking if the HTTP host is in your list of CNAME's and then referencing the client from there.
What the CNAME does is just point to a server location, so if you are using wildcards in your apache configuration, foo.myapp.com resolves to the same location as bar.myapp.com, but in the app can use the host to pull out the subdomain and find the client ("foo" and "bar"). When using a CNAME, like m.mywebsite.com --cnamed--> foo.myapp.com, the application no longer has that client information in the HTTP host, and as we mentioned, the apache wildcard setup (*.myapp.com) just tosses out the subdomain.. so because of this the client must tell us "I will be visiting from m.mywebsite.com, so make that a valid host name for my authentication as well."

Related

How to mask a subdomain URL with CNAME record?

I need to mask the subdomain URL http://3477er.domainB.com with https://sub.domainA.com Both in different servers.
So I create the "sub" alias in domainA server pointing to https://34tter.domainB.com with a CNAME record and waited for its propagation.
I thought I should see http://3477er.domainB.com content when I type http://sub.domainA.com in browser. Instead I get the message DNS_PROBE_FINISHED_NXDOMAIN Isn't this the way a CNAME record works?
Is there any other way to achieve my subdomain masking goal?
If you are receiving a DNS_PROBE_FINISHED_NXDOMAIN error, it means one of the subdomains you listed is not resolving to an IP address. I would test both subdomains here -
https://mxtoolbox.com/DNSLookup.aspx
There are a couple important notes here though -
This will only work if the server on domainB has a binding setup for either any (wildcard) domains (usually bad idea), or a binding specifically for your domainA subdomain.
This will only hide your domainB subdomain on a very basic level, if this is what you need. So, in other words, hiding it from non-tech savvy users. It can't be relied upon if security is a concern, since someone could easily find domainB with a DNS lookup.
To truly mask the 'origin' server, you'd need to implement a proxy. This could either be done by making the requests on your domainB server itself, or by using serverless tech (such as Cloudflare Workers, AWS Lamba, etc.). However, this still won't prevent people making requests directly to domainA if they do discover it.

Custom Domains for a Simple Web App

I've created a really simple databaseless php application that I want to offer as a hosted solution. I've enable wildcard subdomains so that users can sign up and create a subdomain (e.g. "user.myapp.com"). However, I would like to offer the ability for my users to use a custom domain as well if they prefer. I'm pretty sure this can be accomplished by asking the user to add an A Record to their custom domain pointing to my server's IP, but I'm not sure how to handle the domain on my end once they create an A Record pointing to my server's IP.
So, say a user signs up for my service under "user.myapp.com" and then they decide they want to use a custom domain "someuser.com" instead. My specific question is — once the user adds an A Record to their domain "someuser.com" pointing to my server's IP, how do I tell my server to point that domain to "user.myapp.com"? Or is there an easier way to do this?
You'd need to first setup your server to accept requests from someuser.com, which is entirely different than setting up a wildcard for your server alias (e.g. *.myapp.com). You can have a default vhost handle all the hostnames that no other vhost is setup to handle, but then you're still left with mapping someuser.com to user.myapp.com.
Depending on how you've setup your php application, the user's going to need to enter the custom domain they've registered that they had point to your app, then you'll need to know to do that mapping internally by checking the $_SERVER['HTTP_HOST'] server variable to see what host the request is for, and if it's for someuser.com, then map it to user.myapp.com.

Cloud Service Custom Domain Redirection configuration

i am not sure whether this correct words to describe the problem, but i try my best to explain.
Suppose i deployed a cloud service with A Name. now client ask me give me something good domain name rather than A.cloudapp.net, so according to need i given him fancy domain name A.myapp.com.
After some time they thinks A is not a good name , give me B. so i change the deployment to B.cloudapp.net and then configured custom Domain Name as B.myapp.com.
Client again comes as says my customer is still using A.myapp.com. Can you do something to redirect them to B.myapp.com. with message that it moved to another address.
As i know i used only CNAME and ARecord on domain registrar . how can show a message over there. That this page is moved to other domain.
If A.myapp.com is no longer in the DNS records then the only way that it's still working is that the DNS propagation hasn't taken full effect yet. That can take even up to a few days. Once that happens then A.myapp.com should no longer resolve. This might also be working if you have a wildcard record for #.myapp.com pointing to the same A.cloudapp.net site.
You can create the A.myapp.com DNS record (if it's not still there) and point it to the same cloudapp.net app again, but then in your cloud app look at the hostname as it comes it to the request. If it is A.myapp.com show them a specific page that reminds them this is now B.myapp.com and then redirect them.

How will a CNAME DNS affect Google Engine

I'm hosting a clients site at client.mysite.com, but my client want to have its own domain, like www.clientsite.com.
With a CNAME configuration, I'll be able to hook my client domain to the content, but... considering I'm still hosting my clients content, which domain will be finally listed on Google with contents of client.mysite.com contents?
a) mysite.com
b) clientsite.com
Thanks for helping.
In the DNS hierarchy, the CNAME resource record will be attached to the clientside.com. A CNAME is simply a reference to the location of that site's A record. With that in mind, I believe mysite.com will be listed as hosting the data.
Does your client want it to appear under his name?
If so, then this should not be solved using DNS (well, not only using DNS).
If your client wants to get the content listed under his domain name, the best way to do this, is to add their name to your server.
Then point client domain name to your server.
The best way to do the pointing (when also considering SEO)
is to make an webforward (301 permanent) from the root, to the www
and make the www subdomain point to the ressource.
(Or vice verca)
IF you are using the example above (webforward on root) you can use a cname instead of an A record to point the domain name. However do not add a cname to the root of a domain (effectively shutting down your domain name).
So-
Short Answer:
client.mysite.com will have the content (also according to google).
Any attempt to obfuscate this is black hat or grey hat ;)
a better way of doing it is to simply setup the clients domain name on your server.
Then point only one hostname to the server. Server host/headers will take care of the rest.
Setup in DNS
# webforward 301 www
www a or Cname to server
Quick rules:
NEVER put Cname on the root of a domain
Only allow 1 hostname to show content (can be done both as explained above via DNS/webforward or via server configurations)

Domain Mapping To Subdomain

Im running SAAS where customer signs up and a script installation takes place in a subdomain, i.e., subdomain.mydomain.com and starts using the site. Now I want to allow my customers to map their FULL domain eg. www.customerdomain.com to subdomain.mydomain.com, something like bloggers.com or wordpress does. How I can do this. I am using Linux dedicated server. Help would be greatly appreciated. I dont want URL masking or redirection.
I'm currently developing a project and have recently faced the exact same issue. Here's two ways you can go about solving it:
Super-easy
A little more tricky, but not impossible
The first would be to allow domain mapping of subdomains (e.g. http://subdomain.example.com). This is dead simple for your users to setup. They would head over to their registrar and create a new CNAME record as follows:
(name) subdomain.example.com -> (record) subdomain.yoursite.com
Unlike changing A Records, this change only takes about 120 mins to fully propagate (compared with up to 72 hrs).
If your users pay for the privilege of using the domain mapping feature (i.e. it's not made available to users on a free plan), then you could could store each user's custom subdomain in your database, then check against this (in .php) when they try to access your website via their custom subdomain. If they're allowed, do nothing, otherwise redirect them to an alternate url.
So that's the easy one over and done with. Now for trickier option. If you have a dedicated IP address, or in your case a dedicated server, you can use the cPanel API to dynamically create A Records, this way users would be able to map their domain (rather just their subdomain) to your website. You would need to make the following A Record for your customer, together with getting them to update their domain's A Record with your dedicated IP address:
Your server:
(name) customersdomain.com -> (record) subdomain.yoursite.com
Customer's registrar:
www -> (record) [YOUR IP ADDRESS]
I'm not going to detail the API process for you, but you can read through the documentation here:
http://docs.cpanel.net/twiki/bin/view/SoftwareDevelopmentKit/ApiAuthentication
Anyways, I hope this helps and that you have fun building your website!
J
The (name) represents the custom domain belonging to your customer (e.g. customerdomain.com). The (record) would point to their subdomain on your SAAS site. So if I signed up to your website with a username of 'nike', you would use 'nike.yoursite.com'.
J
Install the wordpress domain mapping plugin, obviously your wordpress installation is setup for Wordpress MU.
Now the way I understand it you want to give your bloggers the opportunity to host their blog on their own personal domain while still hosting on your sever. Under "Domain Mapping" in "Settings" of "Network Administrator"(Super User).
There is Domain Options:
You want to check the User domain mapping page that's Option 3.
This will allow your blog users to specify the domain of their personal site. One thing to remind them is that their DNS records should point to your web server.

Resources