Caddy open new port not linked to root project

1. The problem I’m having:

I’m using GitHub - dunglas/symfony-docker: A Docker-based installer and runtime for Symfony. Install: download and `docker compose up`., there is in this project a caddy container with classic ports 80 and 443.

My symfony app is working (I can access https://localhost/), but I need to add a new port, not linked to my symfony app, but used for the interface (usually port 9001).

I opened the port in my docker-compose file, but when I try to access http://localhost:9001 on my Chrome brower, I have a white page with error “ERR_CONNECTION_RESET”.

I I try a random port not opened, I have another error “ERR_CONNECTION_REFUSED”.

If I try to curl http://localhost:9001/ from my container it’s working, I can get the index.html page from the supervisor interface, but I cannot access it from the brower.

I dont know what I have to do or change from my docker compose file or CaddyFile for this to work. I need to have port 80 and 443 linked to my symfony project (/srv/app/public) and the port 9001 linked to nothing ?

Thanks you for your help, if you need more info please ask !

2. Error messages and/or full log output:

* docker ps Output (we can see the port 9001 is opened) :
CONTAINER ID   IMAGE                COMMAND                  CREATED         STATUS                   PORTS                                                                                                                                                                  NAMES
d289fcb5a8b9   gu-market_caddy      "caddy run --config …"   3 minutes ago   Up 3 minutes   >80/tcp, :::80->80/tcp,>443/tcp, :::443->443/tcp,>9001/tcp, :::9001->9001/tcp,>443/udp, :::443->443/udp, 2019/tcp   gu-market_caddy_1
7244028cb623   gu-market_php        "docker-entrypoint /…"   3 minutes ago   Up 3 minutes (healthy)   9000/tcp                                                                                                                                                               gu-market_php_1
0cf830cf94a8   postgres:15-alpine   "docker-entrypoint.s…"   3 minutes ago   Up 3 minutes   >5432/tcp, :::5432->5432/tcp                                                                                                                              gu-market_database_1


* If I check the port with netstat, I can see the port is opened

/srv/app # netstat -tulpen | grep 9001
tcp        0      0  *               LISTEN      134/python3


* If I try to curl http://localhost:9001 from my container, I can see the html from the interface, So inside the container it's working 

/srv/app # curl http://localhost:9001
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
  <title>Supervisor Status</title>
  <link href="stylesheets/supervisor.css" rel="stylesheet" type="text/css" />
  <link href="images/icon.png" rel="icon" type="image/png" />
<div id="wrapper">

  <div id="header">
    <img alt="Supervisor status" src="images/supervisor.gif" />

3. Caddy version:

v2.6.4 h1:2hwYqiRwk1tf3VruhMpLcYTg+11fCdr8S3jhNAdnPy8=

4. How I installed and ran Caddy:

From the project GitHub - dunglas/symfony-docker: A Docker-based installer and runtime for Symfony. Install: download and `docker compose up`. using Docker

a. System environment:

Docker, and I’m on Ubuntu on my local.

c. Service/unit/compose file:

      context: .
      target: app_caddy
      - php
      SERVER_NAME: ${SERVER_NAME:-localhost, caddy:80}
    restart: unless-stopped
      - php_socket:/var/run/php
      - caddy_data:/data
      - caddy_config:/config
      # HTTP
      - target: 80
        published: ${HTTP_PORT:-80}
        protocol: tcp
      # HTTPS
      - target: 443
        published: ${HTTPS_PORT:-443}
        protocol: tcp
      # HTTP/3
      - target: 443
        published: ${HTTP3_PORT:-443}
        protocol: udp
      # Supervisor
      - target: 9001
        published: 9001
        protocol: tcp
        mode: host

d. My complete Caddy config:

    # Debug




route {
    root * /srv/app/public
    mercure {
        # Transport to use (default to Bolt)
        transport_url {$MERCURE_TRANSPORT_URL:bolt:///data/mercure.db}
        # Publisher JWT key
        # Subscriber JWT key
        # Allow anonymous subscribers (double-check that it's what you want)
        # Enable the subscription API (double-check that it's what you want)
        # Extra directives
    php_fastcgi unix//var/run/php/php-fpm.sock
    encode zstd gzip

See Caddyfile Concepts — Caddy Documentation

You must use a site block with braces to have multiple sites in Caddy.