Caddy reverse proxy with domain on Cloudflare

1. Caddy version (2.4.1)

2. How I run Caddy:

Reverse proxy domain to internal service

a. System environment:

Raspberry Pi 4 8GB running Ubuntu Server LTS 20.04.2 LTS

b. Command:

caddy run

d. My complete Caddyfile or JSON config:

azurn.net {
        reverse_proxy localhost:8080
}

3. The problem I’m having:

I’m new to using Caddy and Cloudflare with my own domain to reverse proxy a few subdomains to services I have running. In short, I want to have https://azurn.net go to localhost:8080 which is hosting Vaultwarden. (Smaller self hosted Bitwarden) Yet I cannot get Cloudflare and Caddy to work together and forward the user onto a service running locally.

4. Error messages and/or full log output:

*   Trying 104.21.0.231:80...
* TCP_NODELAY set
* Connected to azurn.net (104.21.0.231) port 80 (#0)
> GET / HTTP/1.1
> Host: azurn.net
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 301 Moved Permanently
< Date: Sat, 05 Jun 2021 00:55:31 GMT
< Transfer-Encoding: chunked
< Connection: keep-alive
< Cache-Control: max-age=3600
< Expires: Sat, 05 Jun 2021 01:55:31 GMT
< Location: https://azurn.net/
< cf-request-id: 0a7b44124a0000c55c013e4000000001
< Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v2?s=SxELsayYPPOtndLypl2f7VcuIzcUZUAdPpXv6cAMQZS30yGpDQyoZia1rr2A%2B%2BYUB3Gyw%2BJ7Ohp%2F9ywp%2FptxCzs%2FDyATP17oNrRYWf1ImjdD1OZE%2BoQW"}],"group":"cf-nel","max_age":604800}
< NEL: {"report_to":"cf-nel","max_age":604800}
< Server: cloudflare
< CF-RAY: 65a56f96dda6c55c-ORD
< alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; ma=86400
<
* Connection #0 to host azurn.net left intact

5. What I already tried:

I’ve ensured that my DNS settings are set to my IP, and have tried other IPs to other public services, which work fine. Clearing the cahce for the domain and putting developer mode on to bypass Cloudflare along with not proxying anything through cloudflare.

6. Links to relevant resources:

Website: https://azurn.net
Vaultwarden: GitHub - dani-garcia/vaultwarden: Unofficial Bitwarden compatible server written in Rust, formerly known as bitwarden_rs

That curl output looks fine, that’s just an HTTP to HTTPS redirect.

What’s in your Caddy logs?

Hello! I’m still a bit new to Caddy, and am unsure where those are at, if any. I looked up a few things, and say I may need to enable logging per site?

Caddy emits logs to stdout and stderr by default. You wrote you’re running Caddy with caddy run, so you should see the logs right in your terminal. If that’s not the case, then please clarify how you’re running Caddy.

Nothing has ever outputted to the console while using caddy run yet always worked with other domains. A new note to add, https://azurn.net shows a Cloudflare error saying there was a error with the SSL configuration which is not compatable with Cloudflare.

I find that hard to believe. There’s something you’re not telling us here. Caddy always emits logs when it runs.

1 Like

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