Fix -ui-dev serving 502 for every page - #5
Closed
comstud wants to merge 1 commit into
Closed
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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