Static files not being served from custom domain

My site: analogous-dev.netlify.app

DNS analogous.dev (www.analogous.dev, technically) is resolving properly, however it takes upwards of 1 minute. The reason for this is static files in the styles/ folder that are not being served properly.

However, they are served just fine from the netlify domain:

curl -I https://analogous-dev.netlify.app/styles/owlCarousel.min.b1f26e29c43c61fe8b5a6f225b4ee7c5f969a7b33cfe512706271e07246d93d1.css
HTTP/2 200
accept-ranges: bytes
cache-control: public, max-age=0, must-revalidate
content-length: 4364
content-type: text/css; charset=UTF-8
date: Mon, 10 Aug 2020 05:34:10 GMT
etag: "01497299afe0e29ce81c735192e4acdb-ssl"
strict-transport-security: max-age=31536000; includeSubDomains; preload
age: 0
server: Netlify
x-nf-request-id: 95c6fa81-69ca-4092-9061-7ea48f1c19fa-1565550

Problem from my custom domain:

curl -I https://analogous.dev/styles/owlCarousel.min.b1f26e29c43c61fe8b5a6f225b4ee7c5f969a7b33cfe512706271e07246d93d1.css
curl: (7) Failed to connect to analogous.dev port 443: Operation timed out

Build, deployment are working great. One thing worth noting - it seems that even the netlify domain is trying to serve static files from the analogous.dev custom domain (and so experiences the timeout). Some wires seem to be crossed somewhere, but it feels like it is within netlify’s side.

One note: I did mis-define my custom domain to be the apex at one point in the process (~24 hours ago), along with setting a CNAME for the apex. I then read some articles, learned the errors of my ways, and set the site to be at www.analogous.dev. I tried clearing the cache to no avail as well.

Any help would be greatly appreciated! Thanks!

@cole Have you tried setting up your DNS as recommended? You seem not to have your A record pointing to 104.198.14.52

Thanks @gregraven! I was hoping to configure using the first part of that article: a CNAME record for a subdomain (www.analogous.dev). I shouldn’t need an A record in that case, should I?

(the apex domain config I mentioned was a mistake I have since corrected).

To follow up here, @gregraven’s solution was correct! I was misunderstanding how my DNS was set up. Though my DNS provider (Namecheap) is configured to redirect analogous.dev → www.analgous.dev, this does not seem to handle sub-resources (i.e. analogous.dev/something to www.analogous.dev/something), at least for the https:// protocol, perhaps?

As a result, the steps Greg mentions is important.

This can be seen easily with the following:

âś— curl -L -I -H 'Host: analogous.dev' https://analogous-dev.netlify.app/styles/owlCarousel.min.b1f26e29c43c61fe8b5a6f225b4ee7c5f969a7b33cfe512706271e07246d93d1.css
HTTP/2 301
cache-control: public, max-age=0, must-revalidate
content-length: 0
content-type: text/plain
date: Tue, 11 Aug 2020 04:12:25 GMT
location: https://www.analogous.dev/styles/owlCarousel.min.b1f26e29c43c61fe8b5a6f225b4ee7c5f969a7b33cfe512706271e07246d93d1.css
strict-transport-security: max-age=31536000
age: 1
server: Netlify
x-nf-request-id: 8882aed7-954c-4576-8060-4e427e137fbc-2451942

HTTP/2 200
accept-ranges: bytes
cache-control: public, max-age=0, must-revalidate
content-length: 4364
content-type: text/css; charset=UTF-8
date: Tue, 11 Aug 2020 04:12:25 GMT
etag: "01497299afe0e29ce81c735192e4acdb-ssl"
strict-transport-security: max-age=31536000
age: 0
server: Netlify
x-nf-request-id: 8882aed7-954c-4576-8060-4e427e137fbc-2452055

âś— curl -I https://www.analogous.dev/styles/owlCarousel.min.b1f26e29c43c61fe8b5a6f225b4ee7c5f969a7b33cfe512706271e07246d93d1.css
HTTP/2 200
accept-ranges: bytes
cache-control: public, max-age=0, must-revalidate
content-length: 4364
content-type: text/css; charset=UTF-8
date: Tue, 11 Aug 2020 04:12:59 GMT
etag: "01497299afe0e29ce81c735192e4acdb-ssl"
strict-transport-security: max-age=31536000
age: 0
server: Netlify
x-nf-request-id: cc3992ea-52f8-4574-a5fe-bec07fdbe269-2326816

The proposed solutions from Netlify in their UI (if I happened to read :see_no_evil:)

  • Recommended: point ANAME or ALIAS record to analogous-dev.netlify.app
  • Alternative: point A record to 104.198.14.52

I have implemented the former, but have not seen success fall through in DNS yet.

That said, my baseURL in my hugo configuration was https://analogous.dev seemed like it may have been the “root cause” of this behavior in particular. I have updated that to be https://www.analogous.dev, which seems to have resolved the most glaring of these issues, at least.

Thanks!

EDIT: Fun read on HTTP vs. HTTPS redirects along with DNS redirects, etc. HTTP Redirects with DNS, and Why HTTPS Redirects are So &!$%-ing Hard

I think I had a URL redirection DNS record from analogous.dev → https://www.analogous.dev because I did not understand what this article is talking about and expected “fewer redirects, the better.” However, DNS redirects should only go to HTTP. Otherwise, you end up in a HTTPS upgrade and the SSL handshake never completing!! TIL!

1 Like

Teamwork makes the dream work! Thanks @gregraven for your help and @cole for the write-up :tada:

1 Like