Caddy http and https on non standard port

Hello everyone thanks for all the previous help :smile:

I am just trying to run caddy on non standard port as my development server.

My caddyfile looks like below:

https://helloworld.com:2085 {

root www/helloworld
log logs/access.log
tls admin@site.com
}

I get the below error:

root@abcd:~/ravkumar/caddy# ./caddy -conf caddyfile.conf
Activating privacy features…2017/09/05 20:42:33 [https] failed to get certificate: acme: Error 400 - urn:acme:error:malformed - Error creating new authz :: DNS name does not have enough labels

Looking to resolve this. Could not find enough information about it.

Any help is appreciated !

Is that your whole Caddyfile, unmodified? (We can’t help if you aren’t giving the exact, unmodified text of your configuration.)

Yes… Thats it
root/helloworld has index.html

I cant run caddy on port 80 or 443 as there are webservices already running on them.

That’s odd. What’s your version of Caddy? caddy -version

root@abcd:~/ravkumar/caddy# ./caddy -version
Caddy 0.10.7

root@abcd:~/ravkumar/caddy# ls -l
total 36464
-rwxr-xr-x 1 test test 18593994 Sep 5 09:25 caddy
-rw-r–r-- 1 root root 95 Sep 6 02:39 caddyfile.conf
-rw-r–r-- 1 root root 18673664 Sep 5 09:28 caddy_v0.10.7_linux_amd64_custom.tar
-rw-r–r-- 1 test test 19128 Sep 5 09:25 CHANGES.txt
drwxr-xr-x 7 test test 4096 Sep 5 09:25 init
-rw-r–r-- 1 test test 25261 Sep 5 09:25 LICENSES.txt
drwxr-xr-x 2 root root 4096 Sep 5 09:57 logs
-rw-r–r-- 1 test test 1008 Sep 5 09:25 README.txt
drwxr-xr-x 3 root root 4096 Sep 5 20:42 www
root@abcd:~/ravkumar/caddy#

acme: Error 400 - urn:acme:error:malformed - Error creating new authz :: DNS name does not have enough labels

A label is one section of a domain name. www.example.com has three - www, example, and com. The minimum number of labels for a publicly addressable domain name is 2 (e.g. example.com).

If you haven’t made a mistake while typing https://helloworld.com:2085 in your Caddyfile, there could be an issue with Caddy.

I’m guessing there’s a space between https and ://helloworld.... in the Caddyfile, that’s causing it to be parsed that way, since the Caddyfile posted above should work.

Thanks for the help. There was a missing ‘/’ in https:// ( my apologies for making everyone take a look at that silly error)

Now that is fixed. I am getting the below logs. ( I don’t want Caddy to use the standard ports as I mentioned it is already being used by other services)

caddy -conf caddyfile.conf
Activating privacy features…2017/09/06 04:24:26 [helloworld.com] failed to get certificate: [helloworld.com] error presenting token: Could not start HTTP server for challenge → listen tcp :80: bind: address already in use
root@abcd:~/ravkumar/caddy#

Is there a way that I can force caddy to use something other than port 80 ?

Alright Thanks guys I got it working with cli flag -http-port and tls self_signed in caddyfile.

./caddy -conf caddyfile.conf -http-port 2086
@matt @Whitestrake
Thanks a lot guys !

Also, I am planning to write a small HOW To article on Caddy server . I hope its okay.

1 Like

From memory, -disable-http-challenge will turn off validation via HTTP-01 challenge (which uses port 80), and Caddy shouldn’t bother binding it in that case. It’ll have to rely on the TLS-SNI-01 challenge, which uses port 443.

1 Like

It worked as well.

Excellent!

We love seeing all sorts of how-tos and articles for however people use Caddy. Post it here in these forums when it’s done!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.