Skip to content

Allow frontend Docker mode to use SERVER_LIST_URL without a mounted /servers.json - #849

Merged
sstidl merged 6 commits into
masterfrom
copilot/fix-server-list-url-requirement
Sep 11, 2026
Merged

sstidl merged 6 commits into
masterfrom
copilot/fix-server-list-url-requirement

Conversation

Copilot AI commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Frontend Docker mode still attempted to copy /servers.json before applying SERVER_LIST_URL, so containers configured with only a remote server list failed at startup. This change makes SERVER_LIST_URL sufficient on its own while preserving the existing mounted-file flow.

  • Entrypoint behavior

    • Guard the early /servers.json copy so frontend/dual mode only uses it when the file exists.
    • Treat SERVER_LIST_URL as a valid frontend configuration when no local /servers.json is mounted.
    • Keep an explicit startup failure for misconfigured frontend containers that provide neither a local server list nor a remote one.
  • Regression coverage

    • Add a Docker/Playwright frontend scenario that starts without /servers.json and uses SERVER_LIST_URL.
    • Verify the served frontend points at the remote list and does not require local backend endpoints.
  • Resulting config paths

    • Supported:
      • mounted /servers.json
      • SERVER_LIST_URL
    • Rejected:
      • frontend mode with neither configured
docker run \
  -e MODE=frontend \
  -e SERVER_LIST_URL="https://example.com/custom-server-list.json" \
  -p 80:8080 \
  ghcr.io/librespeed/speedtest

Copilot AI changed the title [WIP] Fix SERVER_LIST_URL requiring a local /servers.json file Allow frontend Docker mode to use SERVER_LIST_URL without a mounted /servers.json Sep 9, 2026
Copilot AI requested a review from sstidl September 9, 2026 07:32
@sstidl
sstidl marked this pull request as ready for review September 11, 2026 18:41
Copilot AI lite review requested due to automatic review settings September 11, 2026 18:41
@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Support SERVER_LIST_URL-only frontend Docker mode

🐞 Bug fix 🧪 Tests ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Allow frontend containers to use SERVER_LIST_URL without mounting /servers.json.
• Fail frontend startup when neither local nor remote server configuration exists.
• Add Docker/Playwright regression coverage for remote server-list loading with CORS.
Diagram

graph TD
  A["Docker Entrypoint"] --> B{"Mounted list?"} -->|No| D{"Remote URL?"} -->|No| F{"Frontend mode?"} -->|Yes| G["Fail startup"]
  B -->|Yes| C["Copy local list"]
  D -->|Yes| E["Inject remote URL"]
  F -->|No| H["Generate local list"]
Loading
High-Level Assessment

The entrypoint guard and configuration fallback are the most direct approach because they preserve mounted-file behavior while allowing the frontend to fetch its existing remote source. Downloading the remote JSON during startup was considered but would introduce container network availability as a startup dependency and alter the established browser-side loading model.

Files changed (8) +99 / -2

Bug fix (1) +6 / -1
entrypoint.shAccept remote-only frontend server-list configuration +6/-1

Accept remote-only frontend server-list configuration

• Guards '/servers.json' copies so missing mounts no longer terminate frontend or dual startup prematurely. It accepts 'SERVER_LIST_URL' without a local file and explicitly rejects frontend mode when neither source is configured.

docker/entrypoint.sh

Tests (6) +92 / -0
docker-compose-playwright.ymlAdd a remote-list frontend test container +13/-0

Add a remote-list frontend test container

• Defines a frontend-only service without a '/servers.json' mount and configures it with 'SERVER_LIST_URL' on port 18188.

tests/docker-compose-playwright.yml

servers-frontend-remote.jsonProvide a remote frontend server-list fixture +11/-0

Provide a remote frontend server-list fixture

• Adds a server-list response referencing the existing backend testpoint for cross-origin frontend loading tests.

tests/e2e/fixtures/servers-frontend-remote.json

global-setup.jsWait for the remote-list frontend service +1/-0

Wait for the remote-list frontend service

• Extends Docker stack readiness checks to ensure the new frontend-remote container is available before tests execute.

tests/e2e/global-setup.js

env.jsExpose the remote frontend test URL +1/-0

Expose the remote frontend test URL

• Adds the port 18188 base URL for use by Playwright runtime-mode tests.

tests/e2e/helpers/env.js

modes.spec.jsCover SERVER_LIST_URL-only frontend startup +18/-0

Cover SERVER_LIST_URL-only frontend startup

• Verifies modern and stability pages receive the remote URL, no local backend endpoint is exposed, and the browser loads the remote server entry successfully.

tests/e2e/modes.spec.js

static-server.jsServe test fixtures with CORS support +48/-0

Serve test fixtures with CORS support

• Adds a traversal-protected static HTTP server with content types, preflight handling, and permissive CORS headers for remote-list browser tests.

tests/e2e/static-server.js

Other (1) +1 / -1
playwright.config.jsUse a CORS-enabled Playwright static server +1/-1

Use a CORS-enabled Playwright static server

• Replaces Python's basic HTTP server with the test-specific Node server needed to serve the remote server-list fixture with cross-origin access.

playwright.config.js

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Malformed requests stop the test server ✓ Resolved 🐞 Bug ☼ Reliability
Description
static-server.js passes the request pathname to decodeURIComponent() without handling the
URIError raised by invalid percent encoding. Any request containing a malformed escape such as
/% throws synchronously from the request callback, terminating the required Playwright web server
and disrupting the test suite.
Code

tests/e2e/static-server.js[27]

+    const file = path.resolve(root, `.${decodeURIComponent(pathname)}`);
Evidence
The new server handles requests directly and performs an unguarded URI decode before reaching its
filesystem error handling. Playwright config declares this process as the suite's required web
server, so an uncaught decode exception takes down shared test infrastructure.

tests/e2e/static-server.js[15-35]
playwright.config.js[21-24]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Playwright static server decodes request paths without handling malformed percent encoding, allowing one invalid request to terminate the server process.
## Fix Focus Areas
- tests/e2e/static-server.js[25-27]
## Recommended Fix
Wrap URL parsing and `decodeURIComponent()` in a `try/catch`. Return an HTTP 400 response for `URIError` or other invalid URL input, then exit the request handler without resolving or reading a file.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can switch off images and animations for a plain-text comment

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread tests/e2e/static-server.js Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The default classic frontend path can leave an executable ];, causing a JavaScript syntax error for remote-only configurations.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Enables Docker frontend mode to use SERVER_LIST_URL without a mounted /servers.json.

Changes:

  • Updates entrypoint server-list handling and validation.
  • Adds remote frontend Docker/Playwright coverage.
  • Adds a CORS-capable fixture server and remote-list fixture.
File summaries
File Description
tests/e2e/static-server.js Serves fixtures with CORS support.
tests/e2e/modes.spec.js Tests remote-only frontend behavior.
tests/e2e/helpers/env.js Adds the remote frontend URL.
tests/e2e/global-setup.js Waits for the new service.
tests/e2e/fixtures/servers-frontend-remote.json Provides the remote server-list fixture.
tests/docker-compose-playwright.yml Adds the remote-list frontend service.
playwright.config.js Uses the custom static fixture server.
docker/entrypoint.sh Handles local and remote server-list configuration.
Review details
  • Files reviewed: 8/8 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docker/entrypoint.sh Resolved
@sstidl
sstidl merged commit bd8501a into master Sep 11, 2026
3 checks passed
@sstidl
sstidl deleted the copilot/fix-server-list-url-requirement branch September 12, 2026 09:50
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.

Fix SERVER_LIST_URL requiring a local /servers.json

3 participants