fix(ui): Proxy agent API calls from the UI container#60
Merged
Conversation
The UI image now forwards /api/ and /health requests to the FlatRun agent instead of returning 404, restoring connectivity when the image replaces the host nginx that previously performed the proxy. The agent endpoint is configurable via the AGENT_URL environment variable and defaults to host.docker.internal:8090 so the image works against an agent running on the docker host without extra wiring.
Code Review SummaryThe PR introduces an Nginx proxy layer within the UI container to route API requests to a backend agent. This allows the UI container to act as a standalone entry point without needing an external load balancer for basic connectivity. 🚀 Key Improvements
💡 Minor Suggestions
|
| proxy_set_header X-Forwarded-Proto $scheme; | ||
| proxy_connect_timeout 60s; | ||
| proxy_send_timeout 60s; | ||
| proxy_read_timeout 300s; |
There was a problem hiding this comment.
A 300s (5 minute) read timeout is quite high for general API calls. While useful for long-polling or heavy reports, consider if this is appropriate for all /api/ endpoints or if it should be tuned down to 60s to prevent hanging connections.
Suggested change
| proxy_read_timeout 300s; | |
| proxy_read_timeout 60s; |
Collapses the separate API location blocks and the /health rewrite into a single /api block that already covers websocket upgrades and long-lived streams, mirroring the config the installer generates when the UI is deployed from a dist folder. The /assets block is also dropped since the SPA's content-hashed filenames do not need a dedicated caching tier to behave correctly.
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 UI image now forwards /api/ and /health requests to the FlatRun agent instead of returning 404, restoring connectivity when the image replaces the host nginx that previously performed the proxy.
The agent endpoint is configurable via the AGENT_URL environment variable and defaults to host.docker.internal:8090 so the image works against an agent running on the docker host without extra wiring.