I'm trying to setup a Mercure hub with my symfony app.
When I try to publish something on it using the Symfony\Component\Mercure\Publisher class, i'm getting a TransportException from curl : "Couldn't connect to server for "http://localhost:3000/.well-known/mercure"." No reaction from my Mercure hub (launched in local)
I'm trying since yesterday to locate what is wrong with my setup, but I fail to find more information to guide me (a wrong JWT token/key ? a bad allowed-origins setting ?)
I tried using the exact config displayed in Mercure's documentation :
./mercure --jwt-key='!ChangeMe!' --addr=':3000' --debug --allow-anonymous --cors-allowed-origins='*' --publish-allowed-origins='http://localhost:3000'
eyJhbGciOiJIUzI1NiJ9.eyJtZXJjdXJlIjp7InB1Ymxpc2giOlsiKiJdLCJzdWJzY3JpYmUiOlsiaHR0cHM6Ly9leGFtcGxlLmNvbS9teS1wcml2YXRlLXRvcGljIiwie3NjaGVtZX06Ly97K2hvc3R9L2RlbW8vYm9va3Mve2lkfS5qc29ubGQiLCIvLndlbGwta25vd24vbWVyY3VyZS9zdWJzY3JpcHRpb25zey90b3BpY317L3N1YnNjcmliZXJ9Il0sInBheWxvYWQiOnsidXNlciI6Imh0dHBzOi8vZXhhbXBsZS5jb20vdXNlcnMvZHVuZ2xhcyIsInJlbW90ZUFkZHIiOiIxMjcuMC4wLjEifX19.z5YrkHwtkz3O_nOnhC_FP7_bmeISe3eykAkGbAl5K7c
I manage to subscribe to the hub via postman and via my symfony app (a small route that redirects to Mercure, in order to proxy the call through my app authentication).
Is there any way to get more information from mercure or symfony to help me troubleshot the issue ?
EDIT :
With more digging, it seems that the issue is that my Symfony is in a docker container while my mercure hub is on local... Still digging more.
So, after some digging and with the help of Jakumi (thank you, you rock), the issue was that my hub was on my machine localhost while symfony hits on its container localhost. Using http://host.docker.internal:3000
, I manage to reach the hub and publish on it.
Thanks again Jakumi !