Remove hardcoded Tailscale IP, bind server and Vite to localhost only
The Express server was binding to both 127.0.0.1 and a specific Tailscale IP (100.84.4.113), creating two separate http.Server instances. Simplify to a single localhost binding. Also update Vite dev server to use 127.0.0.1 instead of the Tailscale IP and disable the HMR error overlay which obscures the UI during development. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -28,18 +28,12 @@ export function createApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
const TAILSCALE_IP = "100.84.4.113";
|
||||
|
||||
export function startServer() {
|
||||
const PORT = parseInt(process.env.PORT || "3848", 10);
|
||||
const app = createApp();
|
||||
|
||||
// Bind to both localhost and Tailscale — not the public interface
|
||||
const localServer = app.listen(PORT, "127.0.0.1", () => {
|
||||
const server = app.listen(PORT, "127.0.0.1", async () => {
|
||||
console.log(`Session Viewer API running on http://localhost:${PORT}`);
|
||||
});
|
||||
const tsServer = app.listen(PORT, TAILSCALE_IP, async () => {
|
||||
console.log(`Session Viewer API running on http://${TAILSCALE_IP}:${PORT}`);
|
||||
if (process.env.SESSION_VIEWER_OPEN_BROWSER === "1") {
|
||||
const { default: open } = await import("open");
|
||||
open(`http://localhost:${PORT}`);
|
||||
@@ -48,13 +42,12 @@ export function startServer() {
|
||||
|
||||
// Graceful shutdown so tsx watch can restart cleanly
|
||||
function shutdown() {
|
||||
localServer.close();
|
||||
tsServer.close();
|
||||
server.close();
|
||||
}
|
||||
process.on("SIGINT", shutdown);
|
||||
process.on("SIGTERM", shutdown);
|
||||
|
||||
return tsServer;
|
||||
return server;
|
||||
}
|
||||
|
||||
// Only auto-start when run directly (not imported by tests)
|
||||
|
||||
Reference in New Issue
Block a user