Forward specific urls on same domain to different servers - iis

During a rollout of a large site (IIS, .NET, EPiServer) with multiple markets we want to forward markets to the new server when the market has been added to the new web platform, but we still want to use the same domain.
www.customer.com/marketA -> old server, ip 1.1.1.1
www.customer.com/marketB -> old server, ip 1.1.1.1
www.customer.com/marketC -> new server, ip 2.2.2.2
What is best practice for this?
Should we add a load balancer in front of the servers that based on the url sends the traffic to the correct server or is it possible to do this on dns level, or should we let all traffic go to one server and redirect the traffic with HTTPRedirect to the new server. Or is there any other alternatives? (The rollout will take at least 6 month)

You will have to rely on Reverse Proxy with URL Rewrite v2 and Application Request Routing
http://www.iis.net/learn/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing

Related

Hosting Website LIVE on the domain I've bought

I'll get straight to the point.
I have bought a domain. I want to host it on my computer, maybe on a raspberry pi since only 50 persons/month will visit it.
Anywhere I've looked I see two hosting methods, using IIS/WAMP/XAMPP to only create a localhost website or adding the domain to C:\Windows\System32\drivers\etc\hosts.txt that is also... localhost.
What is the magic answer here? How can I host LIVE a website with the domain that I have bought? Am I stuck to using a hosting service? Am I missing something really important?
using IIS/WAMP/XAMPP to only create a localhost website
You need an HTTP server if you want to host a website. It needs to run on the computer you want to host the website from.
adding the domain to C:\Windows\System32\drivers\etc\hosts.txt
That's what you do as a poor man's solution instead of buying a domain name.
The Domain Name needs to be associated with a DNS server (and secondary DNS server) by your registrar.
Usually, a registrar will provide DNS hosting services as part of the deal.
The DNS server needs an A record pointing at the IP address of the computer running the web server. This IP address needs to be available to whomever is going to visit it (which almost certainly needs to be public facing) and should be static (unless you want to play games with very short TTL values and frequent reconfiguration of the DNS servers).
If you plan to host multiple different websites on the same server, you'll probably want to configure the HTTP server software to handle Virtual Name Hosting (whereby it pays attention to the Host header in the request and dynamically serves different content based on it)

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.

Can CloudFlare perform automatic failover to a different backend?

I am looking for an easy way to fail over to a different DC quickly, does CloudFlare offer anything special in this regards with things like health checks or is it just like a standard DNS service?
Update: CloudFlare started a closed beta for the Traffic Manager feature which allows to do exactly this kind of failover:
https://www.cloudflare.com/traffic-manager/
AWS Failover:
The following solution seems to work well when you are hosting your backend system on AWS:
I setup a AWS Route 53 zone with a separate domain (e.g. failover-example.com). Route 53 allows you to setup health checks on the backend server (e.g. the load balancer) with DNS failover. AWS will remove the unhealthy backend system from the DNS record list.
In cloudflare I setup a CNAME for example.com record to failover-example.com and activate the cloudflare proxy on example.com.
The result is that the browser resolves the IP address of example.com to a cloudflare IP address. Cloudflare queries the AWS DNS server to lockup failover-example.com. Cloudflare fetches the content from the resolved IP address and returns the content back to the browser.
In my tests the switch to the other backend system occurs after ca. 20 seconds.
The separate domain is required because cloudflare does not route the traffic through the proxy when the CNAME is a subdomain of example.com.
I have tried to visualize the failover. In theory the failover works with any DNS failover capable service and not only with Route53:
The browser connects always with CloudFlare and hence a DNS failover of the backend system does never effect the browser of the user.
We don't have automatic failover at this time (something we're looking at). We can support the additional DNS entries in your zone file, of course, but you would currently have to manually make the change in that circumstance.
To add -- in the mean time, I'd recommend looking at https://runbook.io
Several other DIY options:
http://blog.booru.org/?p=12
https://vpsboard.com/topic/3341-running-your-own-failover-dns-setup/
https://github.com/marccerrato/python-dns-failover
You'd want to decide if these are the right options for you, of course.

Customers are pointing their domain to our fix IP (web server). How to reroute via CNAME?

We have a web platform that is used by customers from all over the world. We also offer a white-label solution where customers can use their own domain to use our services.
Many point their own domain address by:
a) setting the nameserver to ours - we then do the rest (pointing it to our IP)
b) setting A records to point our fix IP address X.X.X.X directly (this IP belongs to a virtual apache server were our application runs).
FYI: We have full access to DNS.
We'll soon move to Amazon Web Services (Elastic Beanstalk) and are therefore preparing the transfer. During the transfer we want of course the least downtime possible resp. the domains to be showing to the new server address as fast as possible.
Customers a) are easy to handle. We simply set CNAME to point the Elastic LoadBalancer (ELB, no fix IP given thus CNAME) and they will be redirected promptly.
Customers b) though seem to be more complicated. Is there a way to reroute to CNAME -> ELB?
Example:
Given: Customer b) points his domain sub.customer.com directly to our IP X.X.X.X.
What we did: In DNS we opened a new hosted zone for "customer.com" and put CNAME -> ELB for sub.customer.com.
This does not work. What can we do to have sub.customer.com redirected to CNAME (ELB) without changing URL? Maybe with .htaccess or with other DNS modifications?
PS: We are doing this because we can forsee that lots of customers will take ages to change from "A record -> old IP" to "CNAME -> new ELB".
If the customer controls the A record, the customer must change the A record. In this case, the customer most likely controls the NS records upstream as well, so nothing you do on your DNS servers will have any impact at all on the customer's actual domain. You can redirect at the IP level using a tool such as ipf (Debian family) or iptables (Red Hat family) or it's equivalent, but you will have to be very careful in just how you implement that.

Sub-domain hosting on a different server

I have a domain with wildcard - *.mysite.com hosted on Server1
I am planning to host a sub-domain - sales.mysite.com on Server2.
Is this achievable? If yes I have a couple of questions on this.
How does DNS know to which server to point when sales.mysite.com is requested?
Does all traffic come to the Server1 and then redirected to Server2 if the destination calls for sales.mysite.com?
this is very easy to achieve. you need to configure your dns server that subdomain.mydomain.com points to server 1 and subdomain2.mydomain.com points to server 2. the traffic won't be routed via server 1. it will directly go to server 2. thats how DNS works. In the DNS server for each domain an ip address is stored. you just need to specify your 2 ip addresses the correct way for the subdomains and it should work. more infos you can get from wikipedia http://en.wikipedia.org/wiki/Domain_Name_System

Resources