I have an SSL SSH error on Mercure with Symfony

141 views Asked by At

I installed mercury on my symfony application, I have a docker container (which I don't use for mercury at the moment), having my database, nginx and mercury as well as the mercury.exe file, which I uses, my installation seems ok, I have access to the page https://localhost/.well-known/mercure/ui/, however when I send a message (an update) I catch an error 500 "SSL peer certificate or SSH remote key was not OK for "https://localhost/.well-known/mercure".

docker-compose :

            version: '3'
            services:
                php:
                    build: ./docker/php
                    env_file: '.env'
                    volumes:
                    - './:/var/www/mercure-chat:rw'

                nginx:
                    build: ./docker/nginx
                    ports:
                    - 81:80
                    volumes:
                    - './public/:/var/www/mercure-chat/public'

                database:
                    image: mysql:8
                    ports:
                    - 3306:3306
                    volumes:
                    - db-data:/var/lib/mysql
                    environment:
                        MYSQL_ROOT_PASSWORD: secretpass
                        MYSQL_USER: astro
                        MYSQL_PASSWORD: secretpass
                        MYSQL_DATABASE: astrochat

                mercure:
                    image: dunglas/mercure
                    ports:
                    - 3000:80
                    environment:
                        SERVER_NAME: ":80"
                        PUBLISH_URL: '${MERCURE_PUBLISH_URL}'
                        JWT_KEY: '${MERCURE_JWT_KEY}'
                        MERCURE_PUBLISHER_JWT_KEY: ${MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
                        MERCURE_SUBSCRIBER_JWT_KEY: ${MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
                        ALLOW_ANONYMOUS: '${MERCURE_ALLOW_ANONYMOUS}'
                        CORS_ALLOWED_ORIGINS: '${MERCURE_CORS_ALLOWED_ORIGINS}'
                        PUBLISH_ALLOWED_ORIGINS: '${MERCURE_PUBLISH_ALLOWED_ORIGINS}'

            volumes:
            db-data:

env.local:

            # In all environments, the following files are loaded if they exist,
            # the latter taking precedence over the former:
            #
            #  * .env                contains default values for the environment variables needed by the app
            #  * .env.local          uncommitted file with local overrides
            #  * .env.$APP_ENV       committed environment-specific defaults
            #  * .env.$APP_ENV.local uncommitted environment-specific overrides
            #
            # Real environment variables win over .env files.
            #
            # DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
            #
            # Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
            # https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration

            ###> symfony/framework-bundle ###
            APP_ENV=dev
            APP_SECRET=274da4399bdbd51b056d74adbc098892
            #TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
            #TRUSTED_HOSTS='^(localhost|example\.com)$'
            ###< symfony/framework-bundle ###

            ###> symfony/mercure-bundle ###
            # See https://symfony.com/doc/current/mercure.html#configuration
            MERCURE_PUBLISH_URL=https://localhost/.well-known/mercure/
            MERCURE_JWT_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjdXJlIjp7InB1Ymxpc2giOlsiKiJdfX0.aP8SuyD3iv0KzZrkIuptBDK0z35T1g0fUsqqPF_-aII
            MERCURE_PUBLISHER_JWT_SECRET=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjdXJlIjp7InB1Ymxpc2giOlsiKiJdfX0.aP8SuyD3iv0KzZrkIuptBDK0z35T1g0fUsqqPF_-aII
            MERCURE_SUBSCRIBER_JWT_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjdXJlIjp7InB1Ymxpc2giOlsiKiJdfX0.aP8SuyD3iv0KzZrkIuptBDK0z35T1g0fUsqqPF_-aII
            MERCURE_ALLOW_ANONYMOUS=1
            MERCURE_CORS_ALLOWED_ORIGINS=https://localhost:81
            MERCURE_PUBLISH_ALLOWED_ORIGINS='https://localhost'
            ###< symfony/mercure-bundle ###

            ###> doctrine/doctrine-bundle ###
            # Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
            # For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
            # For a PostgreSQL database, use: "postgresql://db_user:[email protected]:5432/db_name?serverVersion=11&charset=utf8"
            # IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
            DATABASE_URL="mysql://root:@localhost:3306/astrochat?serverVersion=10.4.28-MariaDB&charset=utf8mb4"
            MYSQL_USER=root
            MYSQL_ALLOW_EMPTY_PASSWORD=1
            MYSQL_DATABASE=astrochat
            ###< doctrine/doctrine-bundle ###

mercure.yaml :

            mercure:
                enable_profiler: '%kernel.debug%'
                hubs:
                    default:
                        url: http://localhost/.well-known/mercure
                        jwt_provider: App\Services\Mercure\JWTProvider

thanks for help !!

0

There are 0 answers