feat: prefer static dist over Vite dev server in _start_web
manage.sh now checks for frontend/dist/index.html at startup. If present, uses Python http.server (no host-blocking, production mode). Falls back to Vite dev server only when dist is absent. Fixes Vite's "Blocked request. This host is not allowed" error when proxied behind Caddy at menagerie.circuitforge.tech.
This commit is contained in:
parent
a19183ae92
commit
99d17b1898
1 changed files with 12 additions and 4 deletions
12
manage.sh
12
manage.sh
|
|
@ -80,11 +80,19 @@ _start_web() {
|
||||||
warn "Port :${WEB_PORT} already in use by another process — stop it first or change WEB_PORT"
|
warn "Port :${WEB_PORT} already in use by another process — stop it first or change WEB_PORT"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
info "Starting web on :${WEB_PORT}..."
|
# Prefer the pre-built dist (production) over Vite dev server.
|
||||||
|
# Run `./manage.sh build` first to produce frontend/dist/.
|
||||||
|
if [[ -f "frontend/dist/index.html" ]]; then
|
||||||
|
info "Starting web on :${WEB_PORT} (static dist — production mode)..."
|
||||||
|
conda run --no-capture-output -n "$CONDA_ENV" \
|
||||||
|
python -m http.server "$WEB_PORT" --directory frontend/dist >> "$LOG_WEB" 2>&1 &
|
||||||
|
else
|
||||||
|
info "Starting web on :${WEB_PORT} (Vite dev server — no dist found)..."
|
||||||
cd frontend
|
cd frontend
|
||||||
npm run dev >> "$LOG_WEB" 2>&1 &
|
npm run dev >> "$LOG_WEB" 2>&1 &
|
||||||
echo $! > "$PID_WEB"
|
|
||||||
cd "$REPO_DIR"
|
cd "$REPO_DIR"
|
||||||
|
fi
|
||||||
|
echo $! > "$PID_WEB"
|
||||||
local i=0
|
local i=0
|
||||||
while ! _port_open "$WEB_PORT" && (( i++ < 20 )); do sleep 0.5; done
|
while ! _port_open "$WEB_PORT" && (( i++ < 20 )); do sleep 0.5; done
|
||||||
if _port_open "$WEB_PORT"; then
|
if _port_open "$WEB_PORT"; then
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue