fix(gmail): keep tailscale serve path at root
The default Gmail hook path configured by `clawdbot hooks gmail setup` is `/gmail-pubsub`. Tailscale strips the mount path before proxying, so the request lands on `/` and the hook 404s under the default configuration. When Tailscale is enabled, always listen on `/` internally and keep the public URL on the configured path (defaulting to `/gmail-pubsub`). This makes default and custom paths work reliably. Alternative (not implemented here): call tailscale with a full target URL so the backend keeps the path, e.g. `tailscale funnel --set-path /gmail-pubsub http://127.0.0.1:8788/gmail-pubsub`. We did not take this path because it requires changing the CLI invocation to pass URLs (not ports) plus extra validation, which is a larger behavior change.
This commit is contained in:
committed by
Peter Steinberger
parent
0de3bb36d5
commit
26ce65995f
@@ -85,7 +85,30 @@ describe("gmail hook config", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps explicit serve path for tailscale when set", () => {
|
||||
it("keeps the default public path when serve path is explicit", () => {
|
||||
const result = resolveGmailHookRuntimeConfig(
|
||||
{
|
||||
hooks: {
|
||||
token: "hook-token",
|
||||
gmail: {
|
||||
account: "clawdbot@gmail.com",
|
||||
topic: "projects/demo/topics/gog-gmail-watch",
|
||||
pushToken: "push-token",
|
||||
serve: { path: "/gmail-pubsub" },
|
||||
tailscale: { mode: "funnel" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{},
|
||||
);
|
||||
expect(result.ok).toBe(true);
|
||||
if (result.ok) {
|
||||
expect(result.value.serve.path).toBe("/");
|
||||
expect(result.value.tailscale.path).toBe("/gmail-pubsub");
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps custom public path when serve path is set", () => {
|
||||
const result = resolveGmailHookRuntimeConfig(
|
||||
{
|
||||
hooks: {
|
||||
@@ -103,7 +126,7 @@ describe("gmail hook config", () => {
|
||||
);
|
||||
expect(result.ok).toBe(true);
|
||||
if (result.ok) {
|
||||
expect(result.value.serve.path).toBe("/custom");
|
||||
expect(result.value.serve.path).toBe("/");
|
||||
expect(result.value.tailscale.path).toBe("/custom");
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user