whosonfirst / go-webhookd

Go package to implement a bucket-brigrade style webhook server where requests are relayed through a receiver, one or more transformations and one or more dispatchers each of which have interfaces and are defined using a URI-based syntax to allow for custom processing.
BSD 3-Clause "New" or "Revised" License
26 stars 7 forks source link

run daemon in https and automatic https #24

Open dfang opened 3 years ago

dfang commented 3 years ago

insecure receiver listens on http port, the url will be like http://IP:PORT, you can't send ajax requests on a https page.

automatic https support like caddy, and with auth token in header would be better .....

no need to remove insecure receiver, it's best for testing

thisisaaronland commented 3 years ago

This is possible but it is poorly documented (so I will leave this issue open until it is).

The Daemon property of the webhookd config is any valid URI string that can be parsed by the aaronland/go-http-server package:

The go-http-server package does not support automatic certificates (using Let's Encrypt, etc.) yet but if you have a key and certificate pair already you can define the Daemon property to be something like:

https://{HOST}?cert={TLS_CERTIFICATE}&key={TLS_KEY}
dfang commented 3 years ago

I didn't notice that since my code is still tag v0.13, need to update it to the latest v3.0.1.

adding automatic support is pretty easy, see golang.org/x/crypto/acme/autocert.

if you like, i can send a pull request in that repo.

thisisaaronland commented 3 years ago

Sure, a PR would be great.