Repository navigation
Proxy SignalR through nginx and avoid stale web app config caching - #680
Merged
Merged
Conversation
The web app nginx now forwards WebSocket upgrade headers on /live so SignalR works through reverse proxies and Cloudflare Tunnels. The README recommends leaving F1SERVER_URL empty so the browser calls /api and /live on its own origin, and corrects the example port to the container port 80.
SignalR can fall back to Server-Sent Events, which only work through nginx and Cloudflare without response buffering. index.html and assets/env.js are now served with Cache-Control no-cache so configuration changes reach browsers immediately. The README explains the network requirements for addressing the service by name.
|
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.



Pull Request
📖 Description
When the web interface is exposed publicly (for example via a Cloudflare Tunnel), setting
F1SERVER_URLto an internal service address makes the browser call the backend directly. Browsers block these requests from a public origin to a private network address, so the site only works inside the local network.The web app's nginx already proxies
/apiand/liveto the service, so leavingF1SERVER_URLempty makes the browser use relative, same-origin URLs. This PR completes that setup:F1ServerApp/conf/default.conf:Upgrade/Connectionheaders on/liveand raises the read timeout, so SignalR can use WebSockets through the proxy. Without them the WebSocket handshake fails and SignalR falls back to another transport./live, so the Server-Sent Events fallback also works through nginx and Cloudflare./live, because nginx does not inheritproxy_set_headeronce a location defines its own.index.htmlandassets/env.jswithCache-Control: no-cache, so configuration changes reach browsers immediately instead of stale cached copies being used. Hashed bundles keep their normal caching.README.md: recommends leavingF1SERVER_URLempty, notes that only the web app container needs to be exposed, corrects the compose example to use the container port80instead of the published port4820when addressing the service by its compose service name, and explains the user-defined network requirement for name resolution.Fix, no breaking change. Existing setups with
F1SERVER_URLset keep working.🎫 Issues
👩💻 Reviewer Notes
Suggested smoke test: run both containers with
F1SERVER_URLunset,F1SERVER_HOSTset to the service name andF1SERVER_PORTset to80. Open the web app via a public hostname or tunnel and confirm that the API calls and the/liveSignalR connection use the web app's origin, and that the SignalR transport is WebSockets. Also check thatindex.htmlandassets/env.jsare returned withCache-Control: no-cache.📑 Test Plan
No automated tests are affected; the change is limited to the nginx configuration and documentation.
✅ Checklist
General
⏭ Next Steps
F1SERVER_URLentirely once same-origin proxying is the only supported setup.F1SERVER_HOSTat request time (Docker DNS resolver) so the web app container starts even while the service is unavailable.