Can't Access Caddy with HTTPS


(Anthony S) #1

I’m trying to setup SSL for my domain through caddy. I purchased the domain from name.com. I have a basic “It works!” html file that shows up just fine when i specify the domain as “http://mydomain.com” in the Caddyfile. As soon as i change it to https I can no longer reach the page. I pulled down the project along with the appropriate dns provider from here -> https://github.com/caddyserver/dnsproviders (added the import directive to the run.go file) and then i built the new executable. The new executable starts up but behaves exactly like the stock build.

I feel like I might be missing something but I’m not very familiar with Go or how Caddy works. I feel like it’s an issue with caddy generating the certificate. Do I need to move my domain off of name(dot)com to get it to play nice with caddy?

Note: I made sure to open the proper ports.

Caddyfile…

https://mydomain.com {
tls {
dns namedotcom
}
log access.log
errors err.log
}


(Ricardo Boss) #2

Hi! Have you set your environment variables like stated in the documentation?

For namedotcom that is:
NAMECOM_USERNAME
NAMECOM_API_TOKEN

https://caddyserver.com/docs/automatic-https#dns-challenge


(Matthew Fay) #3

Hi @v3xx3d, what output do you get immediately upon running Caddy?

What stops you from reaching the page, exactly?


(Anthony S) #4

@MCMainiac yes I set the environment variables. I already checked that the names were right as well and that i didn’t fudge the api token.

@Whitestrake

Activating privacy features… done.
https://mydomain.com
http://mydomain.com

The browser then tells me the site can’t be reached and that it took too long to respond. But if i revert back to using just http i can access it fine.


(Matthew Fay) #5

The startup message indicates that Caddy is configured correctly to respond to HTTPS requests, and has a valid HTTPS certificate for the site. Combined with the error, the implication is that requests aren’t reaching the HTTPS port.

How do you run Caddy? Is the Caddy host at the edge of the network, or behind NAT?


(Anthony S) #6

I do have a router (Apple Airport Extreme if that matters). I’m forwarding port 443 for my server. I also created the proper rules in the Windows Firewall settings. I also tried disabling the firewall altogether. Not sure what else to try.


(Anthony S) #7

@Whitestrake

Nevermind, my dudes. For some reason my router was allowing me to put 2 ips in the same port-forward entry but only actually opening the port for the first entry. I updated it to have only my server IP and now I can get through.

I wasted so much time trying to figure this out and now I feel like a dunce. lol.

Thanks for your time.