0

I'm trying to make a publish with the Hub Interface but everytime I get this error

SSL connect error for "https://localhost:8000/.well-known/mercure" 

I'm running mercure with the Symfony Local Web Server, so mercure it's running on https://localhost:8000/.well-known/mercure. I have checked and it is running but I can't manage to make a publish. I'm making this call from a controller which is called from Vue.

$update = new Update(
    [
        sprintf("/conversaciones/%s", $conversacion->getId()),
        sprintf("/conversaciones/%s", $recipiente->getUsuario()->getNombre()),
    ],
    $mensajeSerializado,
    true
);
$this->hubInterfacePublisher->publish($update);

Some comment on other question from Stackoverflow mentioned this: Mercure with symfony not working with vue

Mecure dont support self signed certificates and you have to add verify_peer: false in config/dev/framework.yaml under http_client.default_configuration

Tryed it, but didn't work for me. Also, for what I have read, it is not recommended to set it false HTTP Certificates

I also tryed to change https to http on my .env, but I got a 401 Unauthorized.

I have checked on symfonycast tutorials and they have the .env enviroments on localhost:8000 so I think that can't be it, but I don't know what else I can try.

For what I know it has to do with CORS. But don't know how to fix it.

Any help is appreciated,
Thank you :)

  • Which version of Mercure are you running? There have been multiple changes and most tutorials are based on the legacy version of mercure that runs on port localhost:3000 by default. The current release of Mercure uses a Caddy Web Server on `https://localhost` by default, and changing the `SERVER_NAME` to a different port will automatically disable HTTPS support. – Will B. Oct 01 '21 at 00:57
  • If Mercure is running in `DEBUG=true` and `demo` enabled, you should be able to access it at `https://localhost` unless you changed the `SERVER_NAME` in your Caddyfile.dev or command-line params, and see the debugging tools without the Symfony web server running. – Will B. Oct 01 '21 at 01:08
  • I'm using v0.5.3 mercure. With symfony local web server I only had to edit .env parameters -> MERCURE_URL, MERCURE_PUBLIC_URL, MERCURE_JWT_SECRET because a mercure hub is automatically available [link](https://symfony.com/doc/current/mercure.html#running-a-mercure-hub). I'm not using any external file to run mercure, with just ```symfony server:start``` a mercure hub is up and running. – Cristian Rodriguez Navarro Oct 01 '21 at 08:18
  • Hey bro! If you think that is has to do with CORS and you want to test if is it. You can install an extension to (e.g chrome) your navigator wich controll CORS by toggle them on/off. For exemple you have an extension for chrome called : `Allow CORS: Access-Control-Allow-Origin` – yavuz16dev Oct 22 '21 at 10:54

0 Answers0