Skip to content

Mercure hub reachable but Studio never receives events (Docker + Nginx reverse-proxy on EC2) #1516

@Chauhan-Mukesh

Description

@Chauhan-Mukesh

I'm setting up Pimcore Studio with Mercure running in Docker on an Amazon EC2 instance.
Mercure hub starts correctly and responds on /.well-known/mercure, but Studio never receives event streams. No Mercure-related requests appear in the nginx logs, and no publish/subscription activity appears in Mercure logs beyond basic 401 test calls.

Everything looks correctly wired, but Mercure is effectively silent.

Environment

  • Pimcore 12
  • Studio Backend Bundle 2025.2
  • Docker Compose on EC2
  • Accessing server through VSCode Remote-SSH from Windows, with port-forwarding:
{
    "remote.autoForwardPorts": false,
    "remote.forwardOnOpen": true,
    "remote.SSH.defaultForwardedPorts": [
        {
            "name": "pimcore-web",
            "localPort": 9000,
            "remotePort": 80
        }
    ]
}

Relevant Docker Compose Snippets

Addresses & JWT

x-addresses: &address_vars
  PIMCORE_HOSTNAME: php
  MERCURE_HOST: mercure
  WEBSOCKET_HOST: websocket

x-jwt-vars: &jwt_vars
  MERCURE_PUBLISHER_JWT_KEY: "JWTKEY"
  MERCURE_SUBSCRIBER_JWT_KEY: "JWTKEY"

Mercure

mercure:
  image: dunglas/mercure
  ports:
    - "4000:4000"
  environment:
    <<: *jwt_vars
    SERVER_NAME: ':4000'
  healthcheck:
    test: ["CMD", "wget", "-O-", "http://localhost:4000/healthz"]

nginx docker:

    nginx:
        image: dockerhub.docker.artifactory.example.com/nginx:stable-alpine
        environment:
            <<: *address_vars
        ports:
            - "80:80"
        volumes:
            - .:/var/www/html:ro
            - ./scripts/start_nginx.sh:/opt/example/start_nginx.sh:ro
        depends_on:
            # nginx will not start unless it can resolve the "websocket" hostname
            websocket:
                condition: service_started
        command: ["/opt/example/start_nginx.sh"]

Nginx reverse-proxy (extract)

location /hub/ {
    proxy_pass http://REPLACE_WITH_MERCURE_ADDRESS_HERE:4000/.well-known/mercure;
    proxy_http_version 1.1;
    proxy_buffering off;
}

Config.yaml:

pimcore_studio_backend:
    mercure_settings:
        jwt_key: '%env(MERCURE_PUBLISHER_JWT_KEY)%'
        hub_url_client: '<PIMCORE_SCHEMA_HOST>/hub/'
        hub_url_server: 'http://%env(MERCURE_HOST)%:4000/.well-known/mercure'

        cookie_lifetime: 3600
        cookie_same_site: 'lax'

services.yaml:

    mercure:
        hub:
            jwt_key: '%env(MERCURE_PUBLISHER_JWT_KEY)%'

start_nginx.sh (hostname injection)

sed -i 's#REPLACE_WITH_MERCURE_ADDRESS_HERE#'"${MERCURE_HOST}"'#g'

Mercure is reachable directly:

curl http://localhost:4000/.well-known/mercure   → 401
curl http://mercure:4000/.well-known/mercure    → 401

But Studio never receives SSE events:

  • No logs indicating SSE subscription at /hub/.well-known/mercure
  • No publish logs for:
    • handler-progress
    • job-finished
    • clone events
    • asset upload events
  • The Mercure container prints only occasional access logs from curl tests and then sits silent.

Mercure Logs (Representative Extract)
Shows:

  • hub is running
  • direct /mercure calls respond (401 or 200)
  • no publish activity
  • no SSE streams from Studio

Questions

  1. Is there any known issue with the Studio backend/frontend expecting absolute URLs for Mercure when running behind a reverse-proxy on EC2?
  2. Does Studio require CORS/Access-Control-Allow-Origin explicitly for Mercure even on same-host setups?
  3. Should the SERVER_NAME=':4000' be changed when running under Nginx?
  4. Is the /hub/ → /.well-known/mercure proxy mapping correct for the Studio Backend bundle?
  5. Could VSCode SSH port forwarding block SSE upgrade calls from the browser while normal GET requests still work?
  6. Any expected log patterns from Mercure when Studio subscribes, so I can confirm whether Studio even attempts the connection?
  7. Is there any configuration port issue in my setup, how do I varify that mercure is working properly?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions