Caddy 2 listen my port 80 but not listen my subdomain to reverse proxy

1. Caddy version (caddy version):

v2.4.3

2. How I run Caddy:

a. System environment:

ubuntu 18 lts minimal , Google Cloud

b. Command:

caddy run

c. Service/unit/compose file:

-

d. My complete Caddyfile or JSON config:

jenkins.example.com {
        reverse_proxy localhost:8080
}

3. The problem I’m having:

4. Error messages and/or full log output:

2021/07/20 13:13:11.437 INFO    using adjacent Caddyfile
2021/07/20 13:13:11.438 WARN    input is not formatted with 'caddy fmt' {"adapter": "caddyfile", "file": "Caddyfile", "line": 1}
2021/07/20 13:13:11.439 INFO    admin   admin endpoint started  {"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["localhost:2019", "[::1]:2019", "127.0.0.1:2019"]}
2021/07/20 13:13:11.439 INFO    http    server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {"server_name": "srv0", "https_port": 443}
2021/07/20 13:13:11.439 INFO    http    enabling automatic HTTP->HTTPS redirects        {"server_name": "srv0"}
2021/07/20 13:13:11.439 INFO    tls.cache.maintenance   started background certificate maintenance      {"cache": "0xc00026d2d0"}
2021/07/20 13:13:11.440 INFO    tls     cleaning storage unit   {"description": "FileStorage:/home/copi/.local/share/caddy"}
2021/07/20 13:13:11.441 INFO    tls     finished cleaning storage units
2021/07/20 13:13:11.440 INFO    http    enabling automatic TLS certificate management   {"domains": ["jenkins.example.com"]}
2021/07/20 13:13:11.455 INFO    autosaved config (load with --resume flag)      {"file": "/home/copi/.config/caddy/autosave.json"}
2021/07/20 13:13:11.455 INFO    serving initial configuration
cadd^C2021/07/20 13:14:12.335   INFO    shutting down   {"signal": "SIGINT"}
2021/07/20 13:14:12.335 WARN    exiting; byeee!! 👋     {"signal": "SIGINT"}
2021/07/20 13:14:12.338 INFO    tls.cache.maintenance   stopped background certificate maintenance      {"cache": "0xc00026d2d0"}
2021/07/20 13:14:12.339 INFO    admin   stopped previous server {"address": "tcp/localhost:2019"}
2021/07/20 13:14:12.339 INFO    shutdown complete       {"signal": "SIGINT", "exit_code": 0}

and autosave.json

{"apps":{"http":{"servers":{"srv0":{"listen":[":443"],"routes":[{"handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"reverse_proxy","upstreams":[{"dial":"localhost:8080"}]}]}]}],"match":[{"host":["jenkins.example.com"]}],"terminal":true}]}}}}}

5. What I already tried:

i tried to change my Caddyfile config like this

:80 {
        reverse_proxy localhost:8080
}

it worked well, but when I tried to use my subdomain, it was not working, and got the error like this “The page isn’t redirecting properly” , why do I want to use my subdomain? because I want to use multi ports for this case for the next steps after I resolved this.

6. Links to relevant resources:

Hi @ni_poi,

Could you run curl -IL jenkins.example.com and paste the output here?

1 Like

I think I already resolved this to switch DMS only on my Cloudflare, thanks your response anyway😉

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