Nextcloud docker and reverse Proxy Webhook Configuration

Hey Guys! Thanks in Advance for any help. :slight_smile:

I am Using the Nextcloud docker container. I have multiple containers running in that docker network and a Caddy container handling the http/https requests . Here is the part in my Caddyfile:

webhook.staffconnect.agency {
    reverse_proxy host.docker.internal:9000
}

Now I want to configure Webhooks. The webhook app in Nextcloud sends HTTP POST (and seemingly only HTTP) requests. I already have setup another subdomain (webhook.staffconnect.agency) for this and all my webhooks in the future. The goal is to simply run a python script when the webhook is triggered. The Python script is listening in Port 9000 using gunicorn.

Everything works when I send a POST request to my webhook over HTTPS but it does not work if i send it with HTTP. Sending a HTTP POST request on the host machine to the localhost does work.

root@ubuntu:# curl -v -X POST http://webhook.staffconnect.agency/formfill -d "test data"
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 85.215.38.79:80...
* Connected to webhook.staffconnect.agency (85.215.38.79) port 80 (#0)
> POST /formfill HTTP/1.1
> Host: webhook.staffconnect.agency
> User-Agent: curl/7.81.0
> Accept: */*
> Content-Length: 9
> Content-Type: application/x-www-form-urlencoded
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 308 Permanent Redirect
< Connection: close
< Location: https://webhook.staffconnect.agency/formfill
< Server: Caddy
< Date: Wed, 17 Apr 2024 21:39:22 GMT
< Content-Length: 0
<
* Closing connection 0

I also ran a check from inside the Caddy container to see if it resolves right and it did:

curl http://host.docker.internal:9000/formfill -X POST -d "test"
Formfill webhook received

When entering the Nextcloud Container and then checking with curl i get the following (“Formfill webhook received” means success) :

root@ubuntu:~# docker exec -it docuseal_nextcloud_1 bash
root@16b07d0ef4dc:/var/www/html# curl -X POST http://webhook.staffconnect.agency/formfill
root@16b07d0ef4dc:/var/www/html# curl -X POST https://webhook.staffconnect.agency/formfill
Formfill webhook received

Im PAST confused on where the problem is lingering. Maybe someone can help? I really need to get this figured out ^^ .

Cheers!

hellou - quick Bump!