fix: route IM clients through current origin
Deploy im-webapp production / deploy (push) Successful in 1m35s
Deploy im-webapp production / deploy (push) Successful in 1m35s
This commit is contained in:
+3
-7
@@ -19,16 +19,12 @@ export default defineConfig({
|
||||
},
|
||||
server: {
|
||||
port: process.env.PORT ? Number(process.env.PORT) : 8094,
|
||||
// Same-origin dev proxy for the REST layer only -- avoids CORS entirely (the browser only ever
|
||||
// sees http://localhost:8094) so a resolved tenant's *relative* endpoints ("/v1/im", "/v0/file")
|
||||
// work unmodified in local dev, same idea as the old app's hand-rolled dev-proxy-server.js, just
|
||||
// using Vite's built-in proxy instead of a bespoke Node server. The Tinode WS connection itself
|
||||
// does NOT need this: WebSocket isn't subject to the fetch() same-origin policy, so it connects
|
||||
// straight to the tenant's real host regardless (confirmed working this way throughout the old
|
||||
// app's development too).
|
||||
// Same-origin dev proxy for REST, files, and Tinode WebSocket. Production uses the same paths
|
||||
// through Caddy, so local development must expose all three routes too.
|
||||
proxy: {
|
||||
'/v1/im': { target: 'http://127.0.0.1:6060', changeOrigin: true, secure: false },
|
||||
'/v0/file': { target: 'http://127.0.0.1:6060', changeOrigin: true, secure: false },
|
||||
'/v0/channels': { target: 'http://127.0.0.1:6060', changeOrigin: true, secure: false, ws: true },
|
||||
'/legal': { target: 'http://127.0.0.1:6060', changeOrigin: true, secure: false },
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user