Apex domain with http(s) protocol not redirecting to the WWW domain

Hi,
I just deployed my first site on netlify. It is working fine with just 1 caveat. My apex domain is not redirecting to the WWW domain if I prepend http(s):// i.e. if I try to visit http://example.com or https://example.com, I get a “Site can not be reached” error. However, it works if I just visit example.com

My DNS records are in Netlify DNS settings with default values. What should I do so that apex domain with http(s) prepended also redirects to WWW domain.

Thanks

Do you have the www version set as the primary domain in your domain settings in your Netlify dashboard?

Yes. It is the Primary domain.

hey @kshitij,which domain is this regarding? we need to know to be able to take a look, thanks.

The domain is homeupgrade.club. It is the only project in my account at the moment.

Hi, @kshitij, I am seeing this domain redirecting to the www subdomain when I test:

$ curl -svo /dev/null https://homeupgrade.club/  2>&1 | egrep '<\s'
< HTTP/2 301
< cache-control: public, max-age=0, must-revalidate
< content-length: 45
< content-type: text/plain
< date: Mon, 20 Apr 2020 14:28:59 GMT
< location: https://www.homeupgrade.club/
< strict-transport-security: max-age=31536000
< age: 55000
< server: Netlify
< x-nf-request-id: 05277d69-0353-4822-b15a-a988b4a0517f-5491239
<

Note, if you are using Chrome, it will no longer show www in the address bar. Ever. Even when it is actually there:

If this isn’t the root cause or if you are not seeing the redirect when you test, please let us know.

Hey,
It is not redirecting for me when I am visiting https://homeupgrade.club or http://homeupgrade.club by directly typing in the chrome browser. But it redirects when I type homeupgrade.club.
The problem is happening when I am prepending http:// or https:// to the apex domain and then visiting.

Hi, @kshitij, I’ve checked our CDN logs. I’m seeing redirects for any requests to homeupgrade.club in the last day. We have served not a single 200 response for that domain (while we have done so for the www subdomain).

We’d be happy to research this further. Would you please send us a HAR file capture of the issue occurring?

If a HAR file isn’t possible, you can instead send us a x-nf-request-id for a request to the domain homeupgrade.club which doesn’t redirect.

There more information about this header here:

If that header isn’t available for any reason, please send the information it replaces (or as many of these details as possible). Those details are:

  • the complete URL requested
  • the IP address for the system making the request
  • the IP address for the CDN node that responded
  • the day of the request
  • the time of the request
  • the timezone the time is in

Again though, if you send us a HAR file, the headers (and all other details above) will automatically be included in that file.

We look forward to researching this issue further. If there are any questions about gathering this information, please let us know.

Hey, @luke, Here is the link to HAR file

Here is a sample:
X-NF-Request-ID: e3833d37-71fd-4df7-a5cd-4a32b3d2000d-7217719

Hi, @kshitij, the x-nf-request-id e3833d37-71fd-4df7-a5cd-4a32b3d2000d-7217719 shows a 301 response was returned.

For the HAR file, there is almost no information in that file. It only shows there was a Chrome error of net::ERR_CONNECTION_REFUSED for this request.

Notably, there is no IP address recorded for this request. There is no timing information for the lookup either which is unusual.

What is the IP address returned when you run this command on the affected system?

nslookup homeupgrade.club

Hey @luke, This is what I get after nslookup.

~ nslookup homeupgrade.club
Server:         1.1.1.1
Address:        1.1.1.1#53

Non-authoritative answer:
Name:   homeupgrade.club
Address: 157.245.130.6

I tried visiting this above IP address. It gives an error.

Hey, @luke
Any luck?

Hey, @luke
Can you let me know what’s the fix for this issue? Google has started indexing these pages and they are leading to “Site can’t be reached” pages.

Hi, @kshitij, I’m showing the IP address used for the request id e3833d37-71fd-4df7-a5cd-4a32b3d2000d-7217719 came from the continent of Asia.

However, both the IP address used for the request with that x-nf-request-id and the IP address above (the address 157.245.130.6) are in the eastern U.S.A near New York.

The IP addresses being returned by the 1.1.1.1 name server are not utilizing our GeoIP lookups. This name server is directing you to an IP address around the world instead of to a CDN node closest to you.

For example, what IP address is returned if you use one of the authoritative name servers?

nslookup homeupgrade.club dns1.p05.nsone.net

Similarly, what happens for 8.8.8.8?

nslookup homeupgrade.club 8.8.8.8

Would you please let us know what IP addresses those two commands return for you?

Here you go @luke. But it is weirdly working now.

nslookup homeupgrade.club dns1.p05.nsone.net

Server:         dns1.p05.nsone.net
Address:        198.51.44.5#53

Name:   homeupgrade.club
Address: 157.230.35.153
nslookup homeupgrade.club 8.8.8.8
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   homeupgrade.club
Address: 157.230.37.202

Hi, @kshitij, those IP addresses are for two CDN nodes hosted near Singapore. These nodes will give much better performance for people in Asia than CDN nodes near New York.

I’m glad to learn it is working now. You might also consider changing to a different DNS service (something other than 1.1.1.1) as this may also improve your local browsing experience.

If there are other questions about this, we are happy to troubleshoot further.

Thanks, Luke for the support.

Here’s what I get, if that helps:

% nslookup homeupgrade.club dns1.p05.nsone.net
Server:		dns1.p05.nsone.net
Address:	198.51.44.5#53
Name:	homeupgrade.club
Address: 167.172.215.127
% nslookup homeupgrade.club 8.8.8.8
Server:		8.8.8.8
Address:	8.8.8.8#53
Non-authoritative answer:
Name:	homeupgrade.club
Address: 165.227.0.164