Skip to content

Fix -ui-dev serving 502 for every page - #5

Closed
comstud wants to merge 1 commit into
mainfrom
comstud/fix-ui-dev-proxy
Closed

Fix -ui-dev serving 502 for every page#5
comstud wants to merge 1 commit into
mainfrom
comstud/fix-ui-dev-proxy

Conversation

@comstud

@comstud comstud commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

The dev-mode reverse proxy was built with NewSingleHostReverseProxy, which sets Director, and then had Rewrite assigned on top of it. ReverseProxy accepts exactly one of the two: with both set, ServeHTTP hands the request straight to the error handler and returns

http: proxy error: ReverseProxy must have exactly one of Director or
Rewrite set

so every non-/api request under -ui-dev answered 502 instead of reaching the vite dev server. Running the UI against a live backend that way has never worked.

Building the proxy from Rewrite alone keeps the intended behaviour -- Rewrite is the newer API and is what the SetURL/Host lines were written against -- and drops the Director that was only ever an artifact of the constructor.

Nothing outside dev mode is affected: the branch is reached only when -ui-dev is passed, which is why the whole test suite and CI stayed green either way -- and why this carries no test of its own. The regression test for it arrives with the libs/services test suite on comstud/ui-multi-server; to check it by hand, run the UI dev server and start rotom-ng with -ui-dev, which serves pages instead of 502s.

Claude-Session: https://claude.ai/code/session_01AXB8suZYfpYZsSaoEps67m

The dev-mode reverse proxy was built with NewSingleHostReverseProxy, which
sets Director, and then had Rewrite assigned on top of it. ReverseProxy
accepts exactly one of the two: with both set, ServeHTTP hands the request
straight to the error handler and returns

  http: proxy error: ReverseProxy must have exactly one of Director or
  Rewrite set

so every non-/api request under -ui-dev answered 502 instead of reaching
the vite dev server. Running the UI against a live backend that way has
never worked.

Building the proxy from Rewrite alone keeps the intended behaviour --
Rewrite is the newer API and is what the SetURL/Host lines were written
against -- and drops the Director that was only ever an artifact of the
constructor.

Nothing outside dev mode is affected: the branch is reached only when
-ui-dev is passed, which is why the whole test suite and CI stayed green
either way -- and why this carries no test of its own. The regression
test for it arrives with the libs/services test suite on
comstud/ui-multi-server; to check it by hand, run the UI dev server and
start rotom-ng with -ui-dev, which serves pages instead of 502s.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AXB8suZYfpYZsSaoEps67m
@comstud comstud closed this Aug 30, 2026
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.

1 participant