Reverse proxy with *.test, certficate not working

1. Caddy version (caddy version):

v2.3.0

2. How I run Caddy:

I am trying to get a reverse proxy up and running for testing with https locally.

a. System environment:

Mac OS.

b. Command:

sudo caddy run

c. Service/unit/compose file:

paste full file contents here

d. My complete Caddyfile or JSON config:

{
  auto_https disable_redirects
}

jdk.test

reverse_proxy 127.0.0.1:80

3. The problem I’m having:

I am trying to be able to use https://jdk.test and use my site with https, but I cant seem to get the certificate verification to work without an external IP, is there any way of getting around this?

4. Error messages and/or full log output:

5. What I already tried:

Tried different site names but none have worked. Lots of sudo caddy reload

6. Links to relevant resources:

Please read the Automatic HTTPS docs:

Either use the DNS challenge if that’s a real domain that you own, or use tls internal or the local_certs global option to use a local CA managed by Caddy to issue the certificates.

FYI this doesn’t really make sense, because Caddy will bind on port 80, so you’ll be proxying Caddy to itself, probably causing a redirect loop (which I guess you “solved” by using auto_https disable_redirects, but I consider this a mistake here)

Thank you for your reply! It helped me get this working!

We already bind to port 80 with our development environment. We are testing out Caddy purely for the solutions where we need a certificate to work. Is there any way to only use caddy with port 443 so that I can keep our normal setup for the sites and still have access to SSL via Caddy?

Since port 80 is already allocated by our development server I get this when trying to get it to work:
run: loading initial config: loading new config: http app module: start: tcp: listening on :80: listen tcp :80: bind: address already in use

1 Like

For anyone else who finds, this I think I found the correct config:

{
  http_port 8082
  local_certs
}

jdk.test

reverse_proxy 127.0.0.1:80

This config enables me to both use port 80 and 443 in my dev environment! Thanks all involved for an excellent product!

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.