Skip to content

fix: config url - #8304

Merged
wangdan-fit2cloud merged 1 commit into
v3from
pr@v3@fix_config_url
Dec 4, 2026
Merged

wangdan-fit2cloud merged 1 commit into
v3from
pr@v3@fix_config_url

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

fix: config url

Comment thread ui/vite.config.ts
const defaultBackendTarget = 'http://127.0.0.1:8080/'
const projectRoot = fileURLToPath(new URL('.', import.meta.url))

const renameHtmlPlugin = (outDir: string, entry: string) => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The diff shows a single change: the default backend target for the Vite dev proxy was changed from https://mkv3-ee.fit2cloud.cn/ to http://[IP]:8080/.

Irregularities / issues:

  1. [IP] is a placeholder, not a valid host. As written, http://[IP]:8080/ will fail if left unresolved. Note that [IP] in brackets looks like an IPv6 literal, but IP is not valid hex, so URL parsing may throw or the proxy will simply fail to connect. Either substitute a real address or use a clearly-invalid-but-unambiguous placeholder (e.g., http://localhost:8080/).

  2. Loss of TLS. The original used https://; the new default uses plain http://. If the backend still serves HTTPS, this will break (connection refused / protocol error). Confirm the backend actually speaks HTTP on 8080.

  3. Committed placeholder in source code. Hardcoding [IP] in a tracked config file risks it being accidentally shipped or confusing other developers. Prefer driving the target from an environment variable (loadEnv is already imported) rather than editing the source per developer/machine.

  4. Trailing slash. The original had a trailing /; http://[IP]:8080/ also does — just make sure the proxy rewrite logic expects (or normalizes) the trailing slash consistently, since path joining can double slashes otherwise.

  5. Port change implication. Moving to port 8080 suggests a different service than the original production host. Ensure any cookie/CORS/origin expectations (cookies domain, redirect URLs) match, as dev-proxy behavior changes when host/port/scheme change.

Optimization suggestions:

  • Replace the hardcoded constant with an env-driven value, e.g.:
    const defaultBackendTarget = process.env.VITE_BACKEND_TARGET ?? 'http://localhost:8080/'
    and document it in .env.example.
  • Validate the target at startup (e.g., new URL(defaultBackendTarget)) to surface misconfiguration early.
  • If IP-based access is needed, use the fully qualified address (http://192.168.x.x:8080/) and avoid bracket syntax unless truly using IPv6.
  • Add a brief comment explaining why the default differs from production, to prevent future confusion.

No structural problems with the surrounding code are visible from this fragment itself — the concerns above all stem from the changed value.

@wangdan-fit2cloud
wangdan-fit2cloud merged commit e31bf0e into v3 Dec 4, 2026
3 of 4 checks passed
@wangdan-fit2cloud
wangdan-fit2cloud deleted the pr@v3@fix_config_url branch December 4, 2026 10:27
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