Skip to content

[Mercure] Add HTTPS for MERCURE_URL and MERCURE_PUBLIC_URL #1400

Open
@seb-jean

Description

@seb-jean

Hello :),
On my local environment, I'm using an HTTPS connection and the Mercure recipe files. However, MERCURE_PUBLIC_URL and MERCURE_URL are in HTTP.

When I run symfony var:export --multiline | grep MERCURE, I get the following lines:

export MERCURE_PUBLIC_URL=http://127.0.0.1:32928/.well-known/mercure
export MERCURE_URL=http://127.0.0.1:32928/.well-known/mercure

I would rather have the URLs in HTTPS.

Is there any additional configuration missing from the recipe?

# compose.yaml

[...]

###> symfony/mercure-bundle ###
  mercure:
    image: dunglas/mercure
    restart: unless-stopped
    environment:
      # Uncomment the following line to disable HTTPS,
      SERVER_NAME: ':80'
      MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
      MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
      # Set the URL of your Symfony project (without trailing slash!) as value of the cors_origins directive
      MERCURE_EXTRA_DIRECTIVES: |
        cors_origins https://127.0.0.1:8000
    # Comment the following line to disable the development mode
    command: /usr/bin/caddy run --config /etc/caddy/dev.Caddyfile
    healthcheck:
      test: ["CMD", "curl", "-f", "https://localhost/healthz"]
      timeout: 5s
      retries: 5
      start_period: 60s
    volumes:
      - mercure_data:/data
      - mercure_config:/config
###< symfony/mercure-bundle ###
# compose.override.yaml

[...]

###> symfony/mercure-bundle ###
  mercure:
    ports:
      - "80"
###< symfony/mercure-bundle ###

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions