403 "tunneling socket could not be established" on http.proxy

I’m running a basic HTTP Golang web app with gorilla/mux and Caddy as a proxy.

My Caddyfile:

cantillon.fiatjaf.com:4564

gzip
cors
log stdout
errors stdout

startup myapp &
shutdown killall myapp

proxy / 127.0.0.1:18521 {
  transparent
}

Everything works well because myapp is set to listen at port 18521. However, while handling a request at one route, myapp attempts to create a webhook in the Trello API. Before answering the request from myapp, the Trello API will make a HEAD request to the webhook endpoint and expect a 200 response. In this case, the webhook endpoint is at the same app that is attempting to create the webhook, thus the same host.

What is happening is that Trello is unable to reach myapp, so it returns URL (https://cantillon.fiatjaf.com:4564/_/webhooks/board) not reachable. Error: tunneling socket could not be established, statusCode=403.

I’ve tried the same thing without Caddy in front of myapp, and there are no errors. I’ve also tried setting the webhook endpoint to a different webserver in a different port (a Caddy webserver nonetheless) and there were no errors.

My conclusion is that the Caddy proxy is failing to serve more than one request simultaneously, but I don’t know.

I don’t see any logs or errors on my stdout. The HEAD request from Trello doesn’t show.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.