Possible to redirect/render custom error page if domain down? - ruby-on-rails

I'm working on a Rails app that is hosted on Heroku and has a custom domain configured to point to the Heroku DNS target. In other words, it can be accessed at both appname.herokuapp.com and appname.com.
The owner of the app experienced an issue recently where the domain name registrar mistakenly deactivated the domain due to an error in recording the subscription payment. The issue has since been resolved, but the owner wants to know if we can set up a custom error page to show in this situation, instead of the browser error page that would normally show in this case.
I am a novice developer, but my suspicion is that this is not possible. If the registrar believed at the time that the domain did not belong to the person, why would they allow that person to decide the error page or redirect to an alternate version of the site?
Am I correct on this or is there an alternative solution?

Since DNS resolves appname.com to an IP Address. then if DNS is unavailable the machine trying to resolve the address won't have an address to connect to to get the website from.
If the DNS records have a long TTL (time to live - basically the time that it takes to flush the name from the cache of nameservers) then it will stay online even if the DNS server is offline. However this would only work for nameservers that have previously resolved those records.

Related

Heroku - custom domain DNS

I am a complete newbie when it comes to redirecting etc.
I bought a domain (mydomain.co) and I have a heroku app (mydomain.herokuapp.com) (upgrading to paid in the upcoming month). What I want to do is to be able to access the heroku app after entering the domain url and stay o this domain, and not be redirected to mydomain.herokuapp.com.
My settings for the domain look like this (I translated it myself, so there may be some mistakes):
With this settings, I can access my app but it is displayed in a frame, what's more - some of the pages do not work.
What I want to do is to be able to type mydomain.co and display mydomain.herokuapp.com but as regular site, and not inside a frame. What options should I choose?
Another thing is - will I be able to use the domain (which I paid for) and do the redirect if I do not buy a hosting from the company?
PS I added custom domains to my herokuapp and read their [guide], but I still do not understand.3.
Here are also my domain records - I believe it has something to do with this, but it so hard to test it as those DNS changes take some time.
You should remove your redirection. You also need to put a CNAME on mydomain.co with value mydomain.herokuapp.com.

Adding binding hostname in IIS to website breaks site

I'm baffled by an issue with my site in IIS 7 - it works fine when it's the only site that's running, and no binding is being used. I have my domain name www.mysite.com registered with the DNS to point to my IP and it pulls up my site great. However, now I want to add a second site in IIS, so I have to start using the binding host names, but when I put www.mysite.com in as the host name, suddenly I can't pull up the site anymore! And, I don't know if this information is helpful, but if I start up the Default Web Site (that has no bindings) along side my current website that I've added the binding to, the domain name will pull the default web site (IIS7 jpeg) instead! It's like it completely doesn't see the binding I've added, other than the fact that it allows me to run both sites at the same time. It doesn't take time for the binding to take effect in IIS right? Waiting until tomorrow won't make a difference I imagine?
I've done this many times before on other servers, and as far as I can remember, I seem to be doing everything the same as before. I can't figure out why it's not working this time. Am I forgetting something crucial here?
The only difference I can tell is that this domain is hosted with Google, which requires me to update the DNS myself. All those other times, I've called up goDaddy and said, 'Hey, can you point this domain to this IP address?' and they do it for me. Is it possible that I've updated the DNS incorrectly, or incompletely? I don't know if that can be the case if the domain has been pulling up the website just fine all this time until I tried to add the second website on the server... Any ideas?
BTW, this is a virtual server (2008 R2) hosted at atlantic.net - I've never used them before. All the other virtual servers I've used have been with 1and1. Don't know if that makes a difference too.
Ok, I figured it out - turns out the DNS WAS set incorrectly after all! I was able to narrow down the issue when I started creating a bunch of dummy sites and playing with my local computer's hostfile and saw that everything seemed to be routing just fine. So, clearly IIS was working as expected. So, I then called GoDaddy repeatedly until I found someone who agreed to help me with a Google domain. Apparently, from what I could understand, I set the IP address in the wrong place which only made the domain forward as the IP address, so there was no hostname for IIS to match it to, which is why it pulled up the default website (no bindings) with no problems, and ONLY the default website! He directed me to another screen (the DNS Zone File tab) where I could set it properly. Now, everything goes to the expected sites!
Hopefully this will help another newbie out one day when they have to set their own DNS (gasp!)

1and1.com to Heroku

Edit: Just to be clear, actually I only want to use a different webserver, not mail server. It has to stay the same.
I've got a 1and1 plan including webspace and email service. As 1and1 doesn't support Ruby, I created my website at Heroku.
I'm now trying to point my www.example.de url to my example.herokuapp.com domain. As this is the very first time I'm doing this, please alert me if I'm missing something important.
The website uses the 1and1 mail server. I found out that, due to that fact, I can't go the cname way but need a A Record (or ANAME Record?). I already pointed heroku to the right urls and now need to set up 1and1 and a dns service.
I registered at dnsmadeeasy.com and created an ANAME Record:
Name: [left blank]
FQDN or IP: myapp.herokuapp.com
TTL: 1800 (I've got no idea what that is)
After creating that, dnsmadeeasy.com shows me several "System NS Records" which look like nameservers?
ns0.dnsmadeeasy.com
upto
ns4.dnsmadeeasy.com
As far as I understand I now have to enter the nameservers above at 1and1.
My question now is, does this disable the by default working mail server connection? If yes, how would I point back to it from dnsmadeeasy.com? Or is there a better way to do this?
It seems the easy way to do it now is with Point DNS. They have a free developer plan: https://devcenter.heroku.com/articles/pointdns
Enter the Point DNS servers into the 1and1 Domain Manager.
The problem was solved by just adding a A-record at 1and1 pointing at Heroku. No nameservers or any extra service needed.
Here is a more detailed update:
First you have to go to the Heroku app settings. There you can add domains for your app, like www.mydomain.com.
Then you use a service to get the IP address of the server where your Heroku app instance is running. (Just get the IP address of your instance of yourapp#herokuapp.com.) Then you add this IP address as a A-record to the 1and1 app settings. Now you have to wait for the settings to propagate over the DNS servers.
Basically you point your 1and1 app to the server on which your Heroku app runs and inform your Heroku app that there probably is some app trying to reach through to it, which has a specific address, like www.mydomain.com. That's how they find each other.

SEO Destroyed By URL Forwarding - Can't figure out another way

We design and host websites for our clients/sales force. We have our own domain: http://www.firstheartland.com
Our agents fill out a series of forms on our website that are loaded into a database. The database then renders the website as a database driven website.
/repwebsites/repSite.cfm?link=&rep=rick.higgins
/repwebsites/repSite.cfm?link=&rep=troy.thompson
/repwebsites/repSite.cfm?link=&rep=david.kover
The database application reads which "rep" the site is for and the appropriate page to display from the query string. The page then outputs the content and the appropriate CSS to style the page and give it its own individual branding.
We have told the user to use Domain Name Forwarding to get the users to their spot on our server. However, everyone seems to be getting indexed under our domain instead of their own. We could in theory assign an new IP to them, the cost is not the issue.
The issue is how we would possibly accomplish this.
With all of that said, them being indexed under our domain would still be OK as long as they would actually show up high in the ranking for their search term.
For instance, an agent owns TroyLThompson.com. If I search Troy L Thompson, It does not show up in my search. Only, "troy thompson first heartland" works (they show up third)
Apart from scrapping the whole system, I don't know what to do. I'm very open to ideas.
I'm sure you can get this to work as most hosting companies will host hundreds of websites on a single server (i.e. multiple domains on one IP).
I think you need your clients to update the nameservers for their domains (i.e. DNS) to return the IP address of your hosting server. Then you need to configure your server to return the right website based on the domain that was originally requested.
That requires your "database driven website" to look in the HTTP request and check which domain was originally requested, then it can handle the request accordingly.
- If you are using Apache, see how to configure Apache to host multiple domains on one IP address.
- If you are using Microsoft IIS, maybe Host-Header Routing is what you need.
You will likely need code changes on your "database driven website" to cope with these changes.
I'm not sure that having a dedicated IP address per domain will help much, as then you have to find a way to host all those IP addresses from a single web server. However, if your web server architecture already supports a shared database and multiple servers, then that approach might work well for you, especially if you expect the load from some domains to be so heavy that you need a dedicated web server for them.
Google does not include URL in its index which return a 301 status code. The reason is pretty obvious on second thought, because the redirect tells Google "Whatever was here before has moved there, please update your references". One solution I can see is setting up Apache virtual hosts on your server for each external domain, and have each rep configure their domain's DNS A record to point to the IP address of your server.

Rails/Passenger/Apache: Simple one-off URL redirect to catch stale DNS after server move

One of my rails apps (using passenger and apache) is changing server hosts. I've got the app running on both servers (the new one in testing) and the DNS TTL to 5 minutes. I've been told (and experienced something like this myself) by a colleague that sometimes DNS resolvers slightly ignore the TTL and may have the old IP cached for some time after I update DNS to the new server.
So, after I've thrown the switch on DNS, what I'd like to do is hack the old server to issue a forced redirect to the IP address of the new server for all visitors. Obviously I can do a number of redirects (301, 302) in either Apache or the app itself. I'd like to avoid the app method since I don't want to do a checkin and deploy of code just for this one instance so I was thinking a basic http url redirect would work. Buuttt, there are SEO implications should google visit the old site etc. etc.
How best to achieve the re-direct whilst maintaining search engine niceness?
I guess the question is - where would you redirect to? If you are redirecting to the domain name, the browser (or bot) would just get the same old IP address and end up in a redirect loop.
If you redirect to an IP address.. well, that's not going to look very user friendly in someone's browser.
Personally, I wouldn't do anything. There may be some short period where bots get errors trying to access your site, but it should all work itself out in a couple days without any "SEO damage"
One solution might be to use Mod_Proxy instead of a rewrite to proxy traffic to the new host. This way you shouldn't see any "SEO damage".
I used rinetd to redirect the IP traffic from the old server to the new one on IP level. No web server or virtual hosts config needed. Runs very smoothly and absolutely transparent to any client.

Resources