apiplatform mercure start not work : https://caddy "SSL certificate problem"

Viewed 107

Unable to start working with mercury and apiplatform3. However, my configuration is basic. (wsl2 / debian) I kept the basic configuration to be able to start.

     #api/.env
     MERCURE_JWT_SECRET="WExxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxN6P"

    #api/config/packages/mercures.yaml
    mercure:
        enable_profiler: '%kernel.debug%'
        hubs:
            default:
                url: '%env(MERCURE_URL)%'
                public_url: '%env(MERCURE_PUBLIC_URL)%'
                jwt:
                    secret: '%env(MERCURE_JWT_SECRET)%'
                    publish: '*'
    #[Route('/mercure/test', name: 'mercure', methods: ['GET'])]
    public function mercure(HubInterface $hub): Response
    {
        $hub->publish(new Update("https://xxxxxxxxxxxxx.fr/mercure/test",
            json_encode(['status' => 'OutOfStock'])
        ));

        return new Response('published!');
    }

I get an error : failed: SSL certificate problem: unable to get local issuer certificate for "https://caddy/.well-known/mercure/.well-known/mercure"

1 Answers

to add :

framework:
    http_client:
        default_options:
            verify_peer: false
            verify_host: false

to change !!!!!!!! :

MERCURE_URL=http://caddy/.well-known/mercure

MERCURE_URL=https://caddy/.well-known/mercure
Related