ERR_CONNECTION_REFUSED for Chrome only

1. Caddy version (caddy version):

v2.2.1

2. How I run Caddy:

a. System environment:

Ubuntu 18.04.5 LTS (94.15.0-121-generic)

b. Command:

paste command here

c. Service/unit/compose file:


d. My complete Caddyfile or JSON config:

{
    # email to use on Let's Encrypt
    email <email>

    # Uncomment for debug
    #acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
    #debug
}

# Add gzip compression to requests
(webconf) {
  encode gzip
}

# Add forward headers to requests
(theheaders) {
    header_up X-Forwarded-Ssl on
    header_up Host {host}
    header_up X-Real-IP {remote}
    header_up X-Url-Scheme {scheme}
    header_up X-Forwarded-Host {host}
}

build.joycraft-games.com:49946 {
  redir 172.15.1.3:49946
}

build.joycraft-games.com {
    reverse_proxy http://172.16.1.3:8080 {
     import theheaders
    }
    import webconf
    # enable access log for build
    log {
     output file /var/log/caddy-build.log
    }
}

svn.joycraft-games.com {
    reverse_proxy http://172.16.1.4 {
     import theheaders
    }
    import webconf
}

doc.joycraft-games.com {
    reverse_proxy http://172.16.1.8:80 {
     import theheaders
    }
    import webconf
}

ftp.joycraft-games.com {
    reverse_proxy http://172.16.1.5 {
     import theheaders
    }
    import webconf
}

box.joycraft-games.com {
    reverse_proxy http://172.16.1.2:80 {
     import theheaders
     header_down Strict-Transport-Security "max-age=15552000;"
     header_down Referrer-Policy "strict-origin-when-cross-origin"
     header_down X-XSS-Protection "1; mode=block"
     header_down X-Content-Type-Options "nosniff"
     header_down X-Frame-Options "SAMEORIGIN"
    }
    }
    import webconf
    #enable access log for box
    log {
     output file /var/log/caddy-box.log
    }

}

jcgbuild.ddns.net {
    reverse_proxy http://172.16.1.3:8080 {
     import theheaders
    }
    import webconf
}


3. The problem I’m having:

For last 3 days I see weird behavior on google chrome in local network.outside local network everything is working great, and inside local network everything is working too if I use any browser other than chrome based, like firefox, safari, opera, IE. But if I’ll try to access sites using Chrome or Edge there are high chances to get ERR_CONNECTION_REFUSED for every request or sometimes get successful connection for first site and then same error code for every other sites. Sometimes restarting Chrome or whole PC helps, but after a few hours ERR_CONNECTION_REFUSED appears again.

Have no clue where to put my router config info, so I’ll use this section.
For local network I have internal DNS server redirecting every domain listed in CaddyFile to 172.16.1.1 (Caddy’s IP address)
For the Internet I have every incoming 80 and 443 packet redirected to same IP.

4. Error messages and/or full log output:

ERR_CONNECTION_REFUSED

5. What I already tried:

I had Caddy v.2.2.0 running but after update to 2.2.1 nothing changed.
I’ve tried to enable logging to see what’s going on on server side (as you can see in CaddyFile for build.joycraft-games.com and box.joycraft-games.com) but Caddy unable/doesn’t want to create the log files.

6. Links to relevant resources:

So looks Ive found what’s the problem. It isn’t Caddy related but Chrome and DNS. Sorry for troubles, I should rest more.
Just in case here is what I did. Some time ago Google have changed the way how Chrome processes DNS servers and there are no more primary and secondary DNS servers, Chrome just takes info from the fastest respond even if it is 0.00001ms difference. Our ISP got better connection to 8.8.8.8 (or they are hosting local mirrors now, have no idea) so it became as fast as our local DNS. And I know two solutions for that. Turn off Secure DNS in Chrome from chrome://settings/security or, what I did in my case, remove any other secondary DNS servers.
The thread can be closed now.

2 Likes

Thanks for following up with the solution!