Caddy Docker Proxy caddy wildcard hosts

1. The problem I’m having:

I am wondering if I am allowed to specify double wildcard for caddy server context. I want to match any subdomain of any domain. I know I can do *.domain.tld, but I want to match any subdomain of any tld. I don’t have an easy way to test if this is allowed as this is in production and I want to make sure this will work

caddy: "http://*.*"

I also want to know if it is possible to match on url parts instead of domain name. For example below matches for domains phppointofsale.com and phppos.com, but I just watch the match on the path portion of url. Below is what I have now.

 caddy: "http://*.phppointofsale.com/index.php/ecommerce/cron, http://*.phppos.com/index.php/ecommerce/cron, http://*.phppointofsale.com/index.php/ecommerce/manual_sync, http://*.phppos.com/index.php/ecommerce/manual_sync, http://*.phppointofsale.com/index.php/cron/*, http://*.phppos.com/index.php/cron/*, http://*.phppointofsale.com/PHP-Point-Of-Sale-Prev/index.php/ecommerce/cron, http://*.phppos.com/PHP-Point-Of-Sale-Prev/index.php/ecommerce/cron, http://*.phppointofsale.com/PHP-Point-Of-Sale-Prev/index.php/ecommerce/manual_sync, http://*.phppos.com/PHP-Point-Of-Sale-Prev/index.php/ecommerce/manual_sync, http://*.phppointofsale.com/PHP-Point-Of-Sale-Prev/index.php/cron/*, http://*.phppos.com/PHP-Point-Of-Sale-Prev/index.php/cron/*"

2. Error messages and/or full log output:

3. Caddy version:

v2.6.4 h1:2hwYqiRwk1tf3VruhMpLcYTg+11fCdr8S3jhNAdnPy8=

4. How I installed and ran Caddy:

docker caddy proxy (GitHub - lucaslorentz/caddy-docker-proxy: Caddy as a reverse proxy for Docker )

a. System environment:

ubuntu using docker

b. Command:

c. Service/unit/compose file:

  production_php_point_of_sale_app:
    logging:
      driver: "local"
    deploy:
      mode: global
      restart_policy:
        condition: any
      placement:
        constraints: [node.labels.phppos_app == true]
      labels:
        caddy: "http://*.*"
        caddy.reverse_proxy.trusted_proxies: "private_ranges"
        caddy.reverse_proxy: "{{upstreams}}"
    image: phppointofsale/production-app
    build:
      context: "production_php_point_of_sale_app"
    restart: always
    env_file:
      - production_php_point_of_sale_app/.env
      - .env
    networks:
      - app_network
      - mail




d. My complete Caddy config:

This does not apply as this is a configuration question

5. Links to relevant resources:

Nope. Wildcards are only valid on the left-most label.

Just use http:// instead to match all hosts.

We used to allow it, but it’s now deprecated. It was buggy and misleading. I strongly recommend avoiding that. Use request matchers with the path matcher instead.

That’s a pretty old version at this point. Please upgrade.

You should use the trusted_proxies global option instead. See the docs. Using the global option instead unlocks some new features.

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