Reverse proxy from https > http

1. Caddy version (caddy version):

2

2. How I run Caddy:

Caddyfile

a. System environment:

Debian

b. Command:

c. Service/unit/compose file:

d. My complete Caddyfile or JSON config:

paste config here, replacing this text
DO NOT REDACT anything except credentials

3. The problem I’m having:

I just have a small question. Can we do reverse proxy from https to http like that :

services.tls.domain.com {
        reverse_proxy http://51.210.11.40:7701
}

Cause the config is accepted by Caddy v2 (no errors) but it’s not working. I have a 502 Error.

Can you help me please.

4. Error messages and/or full log output:

5. What I already tried:

6. Links to relevant resources:

Yes, absolutely. That’s one of the things Caddy excels at.

You didn’t fill out the template, so I’m unsure how to help you. How are you running Caddy? What’s in your logs? Are you sure your other server is running and can be reached from Caddy?

This is my logs https://pastebin.com/Jb1v8mtq

The other http service is available on web access with direct http://IP:port

Caddy container is started with this docker-compose file :

version: “3.5”
services:
rproxy-auto:
image: caddy
container_name: rproxy-auto
ports:
- 80:80
- 443:443
- 2015:2015
- 2019:2019
- 2020:2020
volumes:
- ./data:/data
- ./www:/usr/share/caddy
- ./config:/config
- ./Caddyfile:/etc/caddy/Caddyfile

Those error logs don’t make sense with the Caddyfile you posted above. Please post your full, unredacted Caddyfile and logs.

Also, please put ``` on lines before and after any config/logs/code you post here, it will preserve the whitespace and make it easier to read. It’s not necessary to put it in pastebin.

Your logs show that you’re trying to get a wildcard cert for *.opybox.com but your config doesn’t have that… that is why we are confused. We require full, undredacted config and logs so we can help troubleshoot problems.

Hello,

This is my full Caddyfile : https://pastebin.com/ExyG9atj

And my docker-compose :

version: “3.5”
services:
rproxy-auto:
image: caddy
container_name: rproxy-auto
ports:
- 80:80
- 443:443
- 2015:2015
- 2019:2019
- 2020:2020
volumes:
- ./data:/data
- ./www:/usr/share/caddy
- ./config:/config
- ./Caddyfile:/etc/caddy/Caddyfile

Thanks for your help :slight_smile:

To get wildcard certificates, you need to enable the DNS challenge. That requires building Caddy with one of the DNS plugins to add support for that: Automatic HTTPS — Caddy Documentation

The other option is to enable on-demand TLS: Automatic HTTPS — Caddy Documentation

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