Skip to content

Comments

Replace preconfigured sites with intelligent dynamic proxy switching#49

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/remove-preconfigured-site-option
Draft

Replace preconfigured sites with intelligent dynamic proxy switching#49
Copilot wants to merge 3 commits intomainfrom
copilot/remove-preconfigured-site-option

Conversation

Copy link
Contributor

Copilot AI commented Nov 27, 2025

Removes the static preconfigured site option and implements automatic proxy configuration switching that detects critical load failures and cycles through configurations until one works (or redirects to 404).

Changes

Removed

  • preconfiguredSites experiment toggle and all related code

Added: Dynamic Loading System (src/utils/dynamic-loading.ts)

  • Error Detection: Monitors for critical errors (JSON parse failures, fetch errors, connection issues, proxy errors) while ignoring minor ones (404s, analytics, fonts, images)
  • Auto-switching: Cycles through 6 proxy configs (UV/SJ × Epoxy/LibCurl × Wisp/Bare) after 3+ critical errors with 500ms debounce
  • Site-specific persistence: Stores working config per domain in localStorage; applies on revisit
  • Cleanup: Reverts to original config on site leave via sync handlers (beforeunload/pagehide)
  • Fallback: Redirects to /404 when all configurations exhausted

Integration

  • proxy.ts: Initializes dynamic loading with BareMux connection, uses active proxy override in encodeURL()
  • index.astro: Tracks site entry/exit, triggers config restoration
  • experiments.astro: Updated toggle syncs with DynamicLoading instance
// Error detection pattern matching
const CRITICAL_ERROR_PATTERNS = [
  /failed\s+to\s+fetch/i,
  /invalid\s+json/i,
  /bare\s+server\s+error/i,
  // ...
];

// Ignored (non-blocking) errors
const IGNORED_ERROR_PATTERNS = [
  /404\s+not\s+found/i,
  /analytics/i,
  /favicon/i,
  // ...
];

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/Radius/Radius/node_modules/.bin/astro build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

remove the preconfigured site option in experaments, and add a massive update to dynamic loading. make dynamic loading now detect when is site cant load by looking for a string of invalid json errors and failed to fetch errors (and any other errors that would fully not load the page) and automaticaly swich to a diffrent proxy config (ignore minor site erros or 404 faild to fetch) swich onley to that config for that site thogh, make a mecanism where after leaveing the site, the origonal config reverts itself. make this minimaly taxing on the system. be shure after ALL proxy configs are thested, it will direct the user to the 404 page.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@codesandbox
Copy link

codesandbox bot commented Nov 27, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copilot AI and others added 2 commits November 27, 2025 14:18
Co-authored-by: sriail <225764385+sriail@users.noreply.github.com>
Co-authored-by: sriail <225764385+sriail@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove preconfigured site option and enhance dynamic loading Replace preconfigured sites with intelligent dynamic proxy switching Nov 27, 2025
Copilot AI requested a review from sriail November 27, 2025 14:31
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.

2 participants