0
votes

I currently have my letsencrypt certs set up for my domain www.example.com and example.com

When I open my server https://www.example.com works perfectly BUT https://example.com will give me

ERR_CONNECTION_REFUSED

I am doing the server the following way

if err := http.ListenAndServeTLS(
    ":443",
    "domain-crt.pem",
    "domain-key.pem",
    Route.router,
); err != nil {
    ERROR.Fatal(err)
}

This gives me no errors and with the www the website works fine. The .pem files are not encrypted and the ListenAndServeTLS doesn't return any error.

1
This sounds more like DNS and IP. Connection refused means that there's no TCP listener on the port (or a facsimile thereof). Do example.com and www.example.com resolve to the same IP? - BJ Black
Could it be my DNS setup? I have A record with host www pointing to my ip and URL redirect record with @ host pointing to www.example.com - Raggaer
"URL redirect records" are a fiction that domain providers use to redirect folks (i.e. that's not an actual DNS thing). Basically what happens is that your A record points to THEIR server, which terminates the first connection and serves an HTTP 302 or similar to go to the address you actually want. In this case, your domain provider isn't providing SSL, so your connect refused. Usually I put the A record for the IP on @ and use a CNAME to redirect "www" -> @ and that's the sanest thing to do if you can. - BJ Black
I can change it yeah. But on my provider it says that "Setting up CNAME for a naked domain may affect email service" should I worry about this? - Raggaer
If @ is an actual A record, www is a CNAME, you have one or more @ MX records, and you are only using [email protected] (and not [email protected]) email addresses, you should be fine. PM me with your domain and I'll hit it with host(1) and see if there are any obvious red flags. - BJ Black

1 Answers

0
votes

This as told in the comments was a DNS error caused by using URL REDIRECT record

I simply added an A record pointint @ to my IP and the same for www