Skip to content

Commit 944328c

Browse files
authored
docs: Expose webhook URLs via Caddy (windmill-labs#450)
1 parent c8b7966 commit 944328c

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

docs/core_concepts/4_webhooks/index.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,36 @@ Useful when some webhooks need to return extremely fast but not just the uuid (d
244244
/>
245245
</div>
246246

247+
## Exposing a webhook URL
248+
249+
Single port proxy can be leveraged to expose a webhook with a custom URL. In its docker-compose, Windmill uses Caddy but the logic can be adapted for others.
250+
251+
In the Caddyfile, the (`handle_path`)[https://caddyserver.com/docs/caddyfile/directives/handle_path#handle-path] and (`rewrite`)[https://caddyserver.com/docs/caddyfile/directives/rewrite#rewrite] directive can be used:
252+
253+
```
254+
{$BASE_URL} {
255+
bind {$ADDRESS}
256+
257+
handle_path /mywebhook {
258+
rewrite * /api/w/demo/jobs/run_wait_result/p/u/bot/hello_world_deno"
259+
# You can optionally inject the token in Caddy to have the endpoint exposed publicly
260+
# request_header Authorization "Bearer <WINDMILL_GENERATED_TOKEN>"
261+
}
262+
263+
...
264+
reverse_proxy /* http://windmill_server:8000
265+
}
266+
```
267+
268+
The job can then be triggered with:
269+
270+
```
271+
curl -X POST \
272+
--data '{}' \
273+
-H "Content-Type: application/json" \
274+
".../mywebhook?payload=<URL_SAFE_BASE64_ENCODED_JSON>"
275+
```
276+
247277
<!-- Resources -->
248278

249279
[runs]: ../5_monitor_past_and_future_runs/index.mdx

0 commit comments

Comments
 (0)