Commit 1ddd002
committed
Accept both host and hostname in isLocalHost
The previous commit (77ed649, "Use hostname not host for
local-handle comparison") fixed Gemini's port-in-WEB_ORIGIN
concern but introduced a regression for non-split-domain
deployments. Without HANDLE_HOST/WEB_ORIGIN set, getInstanceHost
falls back to requestUrl.host (including any non-default port),
so stored handles for a local dev instance at localhost:3000 are
written as @alice@localhost:3000. Stripping the port out of
the comparison in isLocalHost then made those handles fail to
match: the comparison input is localhost:3000 (the stored host
segment) but the check value was localhost (the hostname).
Emoji reactions sent as myemoji@localhost:3000 got misclassified
as remote and returned 404 when no prior remote reaction existed.
Keep the .hostname check (which still addresses the port-in-
WEB_ORIGIN concern) and add the .host comparison back as a
second clause. Both forms are accepted, so split-domain
deployments (where stored handles use HANDLE_HOST without a
port) and non-split-domain dev (where stored handles include
the port from request.host) both work. The comment is rewritten
to spell out why both forms are checked.
#484 (comment)
Assisted-by: Claude Code:claude-opus-4-71 parent a9cea99 commit 1ddd002
1 file changed
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
0 commit comments