Explain a Backend URL/page-origin mismatch instead of a bare fetch error
A real Windows install had sync and backups fail everywhere with "Failed to fetch" while the server itself was fully healthy - confirmed via Invoke-WebRequest returning 200 for every endpoint the browser couldn't reach. The page was opened via a LAN IP while Settings still had the Backend URL set to 127.0.0.1 from an earlier session; browsers treat those as different origins, so the server's CORS check correctly rejected the requests, but a CORS rejection surfaces to fetch() as an unexplained generic error with no indication of the real cause. Settings now detects this mismatch on every render and shows the page's actual address with a one-click button to fix it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1301,6 +1301,8 @@ const TRANSLATIONS = {
|
||||
"settings.pit_role_hint": "Kräver två extra fysiska decoders: en vid depå in och en vid depå ut.",
|
||||
"settings.connection_title": "Backend och anslutning",
|
||||
"settings.backend_url_hint": "Webb/API på datorn som kör npm start, normalt port 8081.",
|
||||
"settings.backend_url_mismatch": "Sidan är öppnad via {origin}, men Backend URL nedan är en annan adress. Webbläsaren blockerar då synk och backup (CORS) - de måste vara identiska.",
|
||||
"settings.backend_url_use_current": "Använd {origin}",
|
||||
"settings.managed_channels_hint": "Fälten Decoder IP / host nedan är de fysiska decodrarnas adresser. Backend startar en AMMC-process per roll på unika portar: main 9000, mellantid 9001, depå in 9002 och depå ut 9003.",
|
||||
"settings.pit_entry_ws_url": "Depå in WebSocket-url",
|
||||
"settings.pit_exit_ws_url": "Depå ut WebSocket-url",
|
||||
@@ -2713,6 +2715,8 @@ const TRANSLATIONS = {
|
||||
"settings.pit_role_hint": "Requires two additional physical decoders: one at pit entry and one at pit exit.",
|
||||
"settings.connection_title": "Backend and connection",
|
||||
"settings.backend_url_hint": "Web/API on the computer running npm start, normally port 8081.",
|
||||
"settings.backend_url_mismatch": "This page was opened via {origin}, but the Backend URL below is a different address. The browser will block sync and backups (CORS) - they must be identical.",
|
||||
"settings.backend_url_use_current": "Use {origin}",
|
||||
"settings.managed_channels_hint": "Decoder IP / host fields below are physical decoder addresses. The backend starts one AMMC process per role on unique ports: main 9000, split 9001, pit entry 9002, and pit exit 9003.",
|
||||
"settings.pit_entry_ws_url": "Pit entry WebSocket URL",
|
||||
"settings.pit_exit_ws_url": "Pit exit WebSocket URL",
|
||||
|
||||
Reference in New Issue
Block a user