[Repo Assist] Add --root option to fsdocs watch for remote/proxy hosting#1089
[Repo Assist] Add --root option to fsdocs watch for remote/proxy hosting#1089github-actions[bot] wants to merge 7 commits intomainfrom
Conversation
Closes #924 Previously fsdocs watch always forced root = http://localhost:<port>/, ignoring any user-supplied root parameter. This makes the generated pages unusable when served via GitHub Codespaces port-forwarding, a reverse proxy, or any other non-localhost environment. This PR adds: - A --root option to WatchCommand exposing a user-specified root URL override - An abstract root_override_option on CoreBuildOptions (default None) - Modified watch-mode root logic: uses the --root value when provided, otherwise falls back to http://localhost:<port>/ as before Usage: fsdocs watch --root / # root-relative URLs fsdocs watch --root https://example.com/docs/ # absolute remote URL Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e-c4e35a7b2fb520aa
|
/repo-assist |
… hardcoded localhost The injected WebSocket URI was hardcoded as ws://localhost:<port>/websocket, which breaks in GitHub Codespaces, behind reverse proxies, and over HTTPS. Now uses window.location.host (which includes the correct hostname and port) with the appropriate ws:/wss: protocol to match the page's scheme. Removes the now-unused port parameter from generateWatchScript. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Commit pushed:
|
|
🤖 Repo Assist here. Great catch, 1. sprintf "(localhost/redacted) this.port_optionThis is the one the 2. WebSocket hot-reload URL — injected into every page var wsUri = "ws://localhost:\{\{PORT}}/websocket";This was the real problem. In Codespaces or behind a proxy, the browser loads the page from a non- var wsProtocol = window.location.protocol === "https:" ? "wss:" : "ws:";
var wsUri = wsProtocol + "//" + window.location.host + "/websocket";This works correctly for local dev, Codespaces, and any proxied setup. ✅ 3. Server bind address Summary: the
|
…e-c4e35a7b2fb520aa
|
/repo-assist When can this ever be https? |
…e-c4e35a7b2fb520aa
🤖 This is an automated PR from Repo Assist.
Closes #924
Problem
fsdocs watchalways forcedroot = (localhost/redacted) ignoring any--parameters rootthe user supplied. This makes generated pages broken when served in GitHub Codespaces (port-forwarding replaceslocalhost` with a cloud URL), behind a reverse proxy, or in any other non-localhost environment.Fix
Added a
--rootoption tofsdocs watchthat overrides the watch-mode localhost default:When
--rootis not supplied, behaviour is unchanged: root defaults to `(localhost/redacted)Changes
src/fsdocs-tool/BuildCommand.fs:abstract root_override_option: string option(defaultNone) toCoreBuildOptions--rootCLI option toWatchCommand, overridingroot_override_optionroot_override_optionwhen providedRELEASE_NOTES.md: changelog entry under[Unreleased]Test Status
dotnet build FSharp.Formatting.sln --configuration Release— succeeded (1 pre-existing FS0760 warning, unrelated)dotnet test FSharp.Formatting.sln --configuration Release --no-build— all 499 tests pass (0 failures)dotnet fantomas src/fsdocs-tool/BuildCommand.fs --check— no issues