URL Rewrite using DNS only - dns

i know you can't redirect the path portion of a URL with DNS only
But is this possible with DNS only?
app1.domain.com --> domain.com:4993
app2.domain.com --> domain.com:4994
(both are https only)
which DNS records do i need to add?

It's not possible with pure DNS. The DNS does not care about the port, but only about the domain. To achieve this check if your DNS provider offers Web Redirecting or Web Forwarding. It's not DNS only, but depending on the reason why you want it to be DNS only this might work for you.

Related

Cloudflare DNS - How to redirect all subdomains to root domain?

Can somebody tell me how I can redirect all subdomains to the root domain in Cloudflare DNS?
I have been looking for a day now without any luck.
I can't use .htaccess because all the subdomains doesn't resolve (They look just like a root domain that haven't propagated) and doesn't return anything, and I don't want to set up hundreds of DNS records for each possible subdomains.
I would like to set up a wildcard dns entry to redirect or at least make all subdomains reachable, so I can either do the rest via the .htaccess, or through DNS.
So how do I make the DNS entry for above requirements?
Thanks.
From the support: Does Cloudflare support wildcard DNS entries?
Cloudflare Free, Pro and Business plan:
We do not proxy wildcard records so these subdomains will be served
directly without Cloudflare performance, security, or apps. The
wildcard domain will have no cloud (orange or grey) on the Cloudflare
DNS Settings page for that reason. If you are adding a * CNAME or A
Record you need to make sure the record is grey clouded in order for
the record to be created.
To get Cloudflare protection on a wildcard subdomain (for example:
www), you explicitly have to define that record in your Cloudflare DNS
settings. First, log into your Cloudflare account and select the DNS
icon. In this example, you would add "www" as its own CNAME record on
your Cloudflare DNS Settings page and toggle the cloud to orange so
the Cloudflare's proxy is enabled.
Unless you are an Enterprise customer, you can't use a wildcard to redirect through Cloudflare.
Make sure the cloud logo is grey to add a wildcard record:

Cloudflare redirecting to from one domain to another?

Is it possible to redirect from domainA.com to domainB.com without domainA.com having any DNS records?
I have two domains that I need to direct to another domain- the two domains don't have any other function than to be redirected. On Cloudflare these domains do not have any DNS records. Can you do this without directing them to a server and do the operations via .htacces, but by simply configuring it on CF?
Thanks!
The domain needs to have DNS records running through our proxy for our PageRules to work.

CloudFlare DNS Overview

This is a definitely a high level question so please take that with a grain of salt. I'm using GoDaddy as my registrar to point to my github pages website. I've uploaded the CNAME file and the URL resolves correctly. I've then set up CloudFlare on my site and am confused as to why I need to switch DNS servers to resolve to an IP address. So now, when the root finds the Top Level Domain for .com, will it now point to the CloudFlare DNS vs the GoDaddy one? In effect am I now just paying GoDaddy for the address and allowing CloudFlare to resolve the IP from the Top Level Domain Servers? Just trying to get an idea of what the CloudFlare DNS server is actually doing and why I had to switch out the GoDaddy one.
CloudFlare is taking over managing the DNS for the domain when you switch to our nameservers (GoDaddy is still your registrar/host). CloudFlare works via authoritative DNS.

How to map domain to hosting server

My client have a dedicated server on liquedweb cloud service and we my web app is hosted on that server. We want our users to map their domain to our server. So they can enjoy our web app by using their domain name. What information I need to provide to my user so he can map domain and what information I need from them?
I don't know much(in fact anything) about domain mapping
thanks
It depends if the server has a dedicated IP address or is natted.
If the server has a dedicated IP address you can ask your clients to point their entire domain to you server by adding the following A records:
Host TTL Protocol Type IP Address
# 300 IN A 1.1.1.1
www 300 IN A 1.1.1.1
Not all domain hosts ask for TTL,if not dont worry about it.
If you want just their subdomain to point to your server (subdomain.website.com)
subdomain IN A 0.0.0.1
TTL is optional in some systems, in this case the default will be used.
Generally it is recommended that you use an IP for the Apex record and not a domain name. EG: example.com is the apex, www.example.com is the www subdomain.
A typical configuration would be below:
Host TTL Protocol Type Result
# 300 IN A 1.1.1.1
www 300 IN CNAME example.com
This is the same config as the top example but using CNAME example.com. It is the same as using A 1.1.1.1, it just means you only need to change one record.
If your server details are a hostname and not an IP address, most systems will not let you use the hostname for the apex so you will need to find out the IP address. (A simple method is to use the nslookup command or dig command).
TTL is how long in seconds a record last before it expires. If you are unsure what you are doing I recommend lowering this so you can correct mistakes more quickly.
Different methods for the different servers. For most of the servers, you have to change the nameservers of your domain.
This mostly needs when your domain registrar and hosting provider both are different.
First Login into your hosting account, navigate to the account details,
then copy the nameservers from there...which would be like :- dns1.hostingprovider.com
dns2.hostingprovider.com
After that, Go to control panel of your domain. Navigate to the nameservers
You will see the link:- dns1.domainregistrar.com
dns2.domainregistrar.com
Paste the above links at the place of below links.
They need the IP address (and possibly instructions on how to configure their DNS servers (which means a variety of different sets of instructions for different servers and control panels)).
You need the domain name.

Block access to a redirected subdomain on an IP basis

I have a subdomain (mail.mywebsite.com) that points to the login page that I've set up for Google apps (per their instructions). I'm currently using a CNAME record to point users to the page.
However, I'd like to restrict access to this subdomain on an IP basis (effectively create a whitelist).
Not sure if modifiying .htaccess on my server is an option, as the domain is configured in the registrar to forward to Google, not content on my server.
Any suggestions for how I could accomplish this? Thanks in advance!
If you've done this using a DNS CNAME, you have no control over who can access mail.mywebsite.com since it's not even your server that's accepting requests (it's Google's server).
Unless there's some way to setup access restrictions on Google, there's not going to be anything that you can do.
Alternatively, you can change the CNAME to point to your server, then use a reverse proxy to proxy the requests to Google. You can then use access controls to setup what IPs will be proxied and all the rest will just get 403'ed. Can't setup ProxyPass in htaccess file though, need to do it in server/vhost config, but you can use the P flag in mod_rewrite to reverse proxy for you.

Resources