Skip to content

fix(api): support internal pusher host and normalize URL parsing (#6856) - #6858

Open
Mateidslx wants to merge 1 commit into
keephq:mainfrom
Mateidslx:fix/pusher-host-handling
Open

Mateidslx wants to merge 1 commit into
keephq:mainfrom
Mateidslx:fix/pusher-host-handling

Conversation

@Mateidslx

Copy link
Copy Markdown

Fixes #6856

/claim #6856

Summary of Changes

In Kubernetes, Docker Compose, and ingress-managed deployments, the WebSocket endpoint accessed by client browsers (e.g. via a public reverse proxy like /websocket) typically diverges from the internal service address accessed by the backend (e.g. \keep-websocket-server:6001). Previously, configuring a relative path or host+path combination caused the backend to crash with
equests.exceptions.InvalidURL\ and frontend WebSockets to fail connecting.

This PR resolves this divergence cleanly with full backward compatibility:

  1. Backend Dedicated Overrides (\keep/api/core/dependencies.py):

    • Supports \PUSHER_HOST_INTERNAL\ and \PUSHER_HOST_PRIVATE\ (with priority over \PUSHER_HOST).
    • Supports \PUSHER_PORT_INTERNAL\ and \PUSHER_PORT_PRIVATE.
    • Supports \PUSHER_USE_SSL_INTERNAL\ and \PUSHER_USE_SSL_PRIVATE.
    • Normalizes \pusher_host\ parsing to support full URLs (\http://..., \https://...), host:port pairs (\keep-websocket:6001), and host/path combinations (\soketi-svc/websocket).
    • Safely guards against relative paths (/websocket) without crashing, logging a clear actionable warning.
  2. Frontend Support & Parsing (\keep-ui):

    • Supports \PUSHER_HOST_CLIENT\ and \PUSHER_HOST_PUBLIC\ (and port overrides) in \keep-ui/shared/lib/server/getConfig.ts.
    • Prevents \NaN\ port evaluation in \getConfig.ts\ when port is not explicitly specified.
    • Normalizes \wsHost, \wsPath, and \wsPort\ in \keep-ui/utils/hooks/usePusher.ts\ so that host+path and URL values cleanly separate into valid WebSocket host and path segments.
  3. Documentation (\docs/deployment/configuration.mdx):

    • Documented the internal backend and client override environment variables.
  4. Testing & Validation:

    • Added unit test suite in \ ests/test_pusher_dependencies.py\ covering all 11 resolution, override, and normalization permutations (disabled, relative path safety, internal/private overrides, host:port, http/https URLs, host/path, and numeric app ID validation).
    • Validated against repo linting rules using
      uff==0.11.4\ and \�lack.

@CLAassistant

CLAassistant commented Sep 29, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Mateidslx

Copy link
Copy Markdown
Author

Hi @shahargl, all CI checks are green, CLA is signed, and 11 unit tests in ests/test_pusher_dependencies.py cover all host/port/scheme override cases. Ready for review and merge!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: PUSHER_HOST behaves differently between client and server

2 participants