Webhooks inside docker containers
-
Hi guys,
I am trying to handle a webhook from fusion auth which is running on a docker container to my application which also runs on a docker container in the same network.
I am trying to set up the webhook to the name of the container (app) in the same network and the corresponding port (8081). In my case HTTP://app:8081/webhooks, but always getting connection refused which means that either port or host is not listening for connections.
Tested curl post to the application's endpoint that handles webhooks - working.
The webhooks endpoint works with basic HTTP auth which is configured in the webhooks section. Again tested with curl and it is working.
Any suggestions on how to connect set up the webhook?
Thanks in advance.
-
Hi @ggyurov , welcome to the FusionAuth community!
This seems like a bit of a docker networking question. I'm no expert, but let me try to help.
Tested curl post to the application's endpoint that handles webhooks - working.
From where are you running curl? The host machine? The docker container with the application? A different docker container in the same network?
-
I've come across the same issue. FusionAuth and my webhook endpoint are both on the same network (docker compose). I've tried setting the webhook URL to the container name (invoicing.api) with the corresponding port, https://invoicing.api:5001. The call never reaches my api. Testing through Postman or Swagger which are running on the same machine but outside the docker network works fine using https://localhost:5001/fusionauthwebhook.
I came across a similar issue with FusionAuth and my web app authority URL not working when using the container name in the URL, but this was solved by using the local machine IP in it's place. That doesn't seem to work for webhooks. Using the local machine IP in the webhook URL, i.e. https://192.168.0.110:5001/fusionauthwebhook, didn't solve it.
-
@ronn316 We have some guidance about reaching out from FusionAuth to another machine on the network, but the right answer really depends on what the docker network configuration looks like.