I'm managing two domains domainA.com
and domainB.com
on DNS Made Easy. Both domains point to the same EC2 instance.
domainA
had a HTTP redirection record for www.domainA.com
to domainA.com
, that record was deleted and replaced by a CNAME record for www.domainA.com
to domainA.com
.
domainB.com
has a CNAME record for www.domainB.com
to domainB.com
.
When I go to http://domainB.com
the page loads correctly, but when I go to http://www.domainB.com
I get redirected to https://www.domainA.com
, notice the secure protocol here!
My first thought was that the HTTP redirection record for domainA.com
was being cached, but the guys at DNS Made Easy pointed out that executing $ curl -I http://www.domainB.com
returned:
HTTP/1.1 301 Moved Permanently
Content-Type: application/x-msdownload
Connection: keep-alive
Status: 301 Moved Permanently
Location: https://domainA.com/
X-Powered-By: Phusion Passenger 4.0.53
Date: Fri, 08 Jan 2016 19:21:41 GMT
Server: nginx/1.6.2 + Phusion Passenger 4.0.53
So I looked in NGINX's sites-available
directory for any HTTP redirects configured on domainA.com
and domainB.com
domainA
looks like this:
server {
listen 80;
listen 443 ssl;
ssl_certificate /etc/ssl/domainA.pem;
ssl_certificate_key /etc/ssl/domainA.key;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
root /webapps/domainA/current/public;
server_name domainA.com;
passenger_enabled on;
rails_env production;
}
And domainB
looks like the following:
server {
listen 80;
root /webapps/domainB/current/public;
server_name domainB.com;
passenger_enabled on;
rails_env production;
}
Nothing there, so then I thought to look in AWS but Route 53 is not even setup!
So now I'm really out of ideas, and I'm a web developer so server stuff is not really my strong suite so any ideas would be really appreciated.