Scenario / Questions

I’m trying to set up a website using an Ubuntu machine running nginx. For some reason, I’m able to access the site by the domain name in Safari and Firefox, but in Chrome it’s unable to access the server. However, I’m able to use curl, Postman, etc. and I get the index.html back as I’d like to.

I found that in Chrome I’m able to access the site using the IP address, and I’m totally lost on where to check next.

Here’s my configuration file:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ =404;
    }

}

I’ve changed the response code just to make sure that this is the configuration that I’m actually hitting.

Any help would be appreciated!

Edit: The domain is gwilliam.dev

Find below all possible solutions or suggestions for the above questions..

Suggestion: 1

Your problem is because you are using a .dev domain.

The entire .dev top-level domain (TLD) is on the HSTS preload list and that means you must access it using HTTPS. According to your nginx config snippet, you are only providing HTTP bindings, not HTTPS.

In fact, I am surprised that you are able to access the domain using Firefox, since Firefox has been forcing .dev to HTTPS since at least mid-2018. You might be using a very old version, in which case you should upgrade immediately.

The easiest way to get HTTPS support on your site is LetsEncrypt. Once you have that set up, your site should work in Chrome.

Suggestion: 2

Start by verifying that chrome is properly resolving the target site’s hostname (FQDN) to the correct IP address, by looking at Chrome’s dns cache a few seconds after you try opening the site in chrome. You can view the Chrome dns cache by opening chrome://net-internals/#dns in Chrome.

Depending on whether the FQDN is listed in Chrome’s dns cache, and whether the IP is correct, will give you an idea what to do next.

If the FQDN is listed but incorrect, Chrome is getting the wrong IP from somewhere. If its not even listed, then Chrome is not resolving the IP address. Either way you will narrow down what is actually happening.

Some things to try with Chrome.

  1. Try in a private tab.
  2. Login to the same computer as a different user. If the behavior is the same, it’s a system-wide setting, possibly the Chrome version. If it works as another user, it is a problem in your Chrome profile.
  3. Try temporarily setting up a fresh Chrome user
    profile to see if that fixes the issue. If it does it is one of
    your Chrome settings. You can google where you Chrome profile is
    located, which varies based on the operating system. All you have
    to do is move it out of the way while Chrome is closed, then when
    you re-open Chrome it will generate a new profile. Once you are
    done verifying, you can delete the new temporary profile, and
    restore the original. There is lots of information on how to do
    this, so Google it for screenshots/details if you need to.