Port Forwarding to services with integrated Proxy Server

Hi everybody, I researched the caddy docs and couldn’t find an answer to my question. I think it might not be possible but maybe I just missed it and someone can help :smiley:

1. The problem I’m having:

I want to proxy to my http-services and additionally simply portforward to https-services. The service is a VM and needs 3 subdomains and comes with cert-management and a proxy included.

My conf right now:

https://dev.xxxx.de {
        reverse_proxy * http://192.168.223.12:3000
}

Works great, caddy feels like magic!

What i want to achieve:

https://dev.xxxx.de {
        # reverse_proxy * http://192.168.223.12:3000
        respond "test"
}
https://service.xxxx.de {
        portforward :443 192.168.223.12:443
}

Basically like a normal Port Forward in a Firewall.

Thank you in advance!!

2. Error messages and/or full log output:

3. Caddy version:

2.10.0

4. How I installed and ran Caddy:

Docker compose with:

docker compose up -d

services:
  caddy:
    image: caddy:latest
    container_name: caddy
    restart: always
    networks:
      - reverseproxy-nw
    stdin_open: true
    tty: true
    volumes:
      - ./container-data:/data
      - ./container-config:/config
      - /etc/localtime:/etc/localtime:ro
    ports:
      - 80:80
      - 443:443
    entrypoint: /usr/bin/caddy run --adapter caddyfile --config /config/Caddyfile

networks:
  reverseproxy-nw:
    external: true

a. System environment:

Ubuntu 24.04.2 LTS

b. Command:

c. Service/unit/compose file:

see above

d. My complete Caddy config:

https://dev.xxxx.de {
        # reverse_proxy * http://192.168.223.12:3000
        respond "test"
}

5. Links to relevant resources:

Have you tried using https://?

Hi Mohammed,

your tip worked, i set a local dns record for the revproxy domain and then used the same fqdn as the incoming one in the Caddyfile and it worked. Thx!

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