fix(deploy): load vite preview config for md.tkmind.cn host
LaunchAgent web startup must use vite-preview.config.mjs so preview allowedHosts includes md.tkmind.cn instead of blocking nginx requests. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||||
export ADM_PORT="${ADM_PORT:-5174}"
|
export ADM_PORT="${ADM_PORT:-5174}"
|
||||||
|
export ADM_WEB_HOST="${ADM_WEB_HOST:-0.0.0.0}"
|
||||||
|
export ADM_DEV_BACKEND="${ADM_DEV_BACKEND:-http://127.0.0.1:8085}"
|
||||||
export NODE_BIN="${NODE_BIN:-/opt/homebrew/opt/node@24/bin/node}"
|
export NODE_BIN="${NODE_BIN:-/opt/homebrew/opt/node@24/bin/node}"
|
||||||
export PATH="/opt/homebrew/opt/node@24/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:${PATH}"
|
export PATH="/opt/homebrew/opt/node@24/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:${PATH}"
|
||||||
cd "${ROOT}"
|
cd "${ROOT}"
|
||||||
@@ -9,4 +11,8 @@ if [[ ! -d dist ]]; then
|
|||||||
echo "dist/ missing; run npm run build first" >&2
|
echo "dist/ missing; run npm run build first" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
exec "${NODE_BIN}" ./node_modules/vite/bin/vite.js preview --host 0.0.0.0 --port "${ADM_PORT}" --strictPort
|
exec "${NODE_BIN}" ./node_modules/vite/bin/vite.js preview \
|
||||||
|
--config scripts/vite-preview.config.mjs \
|
||||||
|
--host 0.0.0.0 \
|
||||||
|
--port "${ADM_PORT}" \
|
||||||
|
--strictPort
|
||||||
|
|||||||
@@ -12,7 +12,16 @@ export default defineConfig(({ mode }) => {
|
|||||||
host: env.ADM_WEB_HOST ?? env.ADM_API_HOST ?? '127.0.0.1',
|
host: env.ADM_WEB_HOST ?? env.ADM_API_HOST ?? '127.0.0.1',
|
||||||
port: Number(env.ADM_PORT ?? 5174),
|
port: Number(env.ADM_PORT ?? 5174),
|
||||||
strictPort: true,
|
strictPort: true,
|
||||||
allowedHosts: ['md.tkmind.cn', 'gadm.tkmind.cn', 'localhost', '127.0.0.1', '10.10.0.2', '58.38.22.103'],
|
// Behind nginx/Caddy on md.tkmind.cn; allow production hostnames explicitly.
|
||||||
|
allowedHosts: [
|
||||||
|
'md.tkmind.cn',
|
||||||
|
'gadm.tkmind.cn',
|
||||||
|
'localhost',
|
||||||
|
'127.0.0.1',
|
||||||
|
'10.10.0.2',
|
||||||
|
'58.38.22.103',
|
||||||
|
'.tkmind.cn',
|
||||||
|
],
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': backend,
|
'/api': backend,
|
||||||
'/auth': backend,
|
'/auth': backend,
|
||||||
|
|||||||
Reference in New Issue
Block a user