Caddyfile cover subdomain without domain

1. Caddy version:

2.6.2-alpine

2. How I installed, and run Caddy:

Running on docker host

a. System environment:

Ubuntu server 22.04
Docker version 20.10.22, build 3a2c30b

b. Command:

docker run

d. My complete Caddy config:

Caddy main config

import /etc/caddy/Sites/*.caddy

:80 {
        root * /usr/share/caddy
        file_server
}

Caddy config to import

project.namespace.hostname:80 {
	reverse_proxy container:80
}

3. The problem I’m having:

Hello, i have a simple caddy setup. Caddy is running in a container and exposes various apache containers. With that it’s possible to access each apache instance though port 80 on http://project.namespace.hostname/ . The setup should be portable, but in the caddy files that are being imported the hostname is constant. So my question is, how it could be accomplished to have the hostname not in the config.

Use environment variables.

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