@enfyra/sdk-nuxt 0.3.28 → 0.3.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../../src/runtime/utils/server/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,IAAI,CAAC;AAa3C,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../../src/runtime/utils/server/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,IAAI,CAAC;AAa3C,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,4BAgC7D"}
|
|
@@ -16,8 +16,9 @@ export function proxyToAPI(event, customPath) {
|
|
|
16
16
|
const headers = event.context.proxyHeaders || {};
|
|
17
17
|
const isWebSocket = event.node.req.headers["upgrade"]?.toLowerCase() === "websocket";
|
|
18
18
|
if (isWebSocket) {
|
|
19
|
+
event.node.req.url = rawPath;
|
|
19
20
|
proxy.web(event.node.req, event.node.res, {
|
|
20
|
-
target:
|
|
21
|
+
target: config.public?.enfyraSDK?.apiUrl || process.env.API_URL || "http://localhost:1105",
|
|
21
22
|
ws: true,
|
|
22
23
|
changeOrigin: true,
|
|
23
24
|
headers
|
package/package.json
CHANGED
|
@@ -24,10 +24,14 @@ export function proxyToAPI(event: H3Event, customPath?: string) {
|
|
|
24
24
|
const isWebSocket = event.node.req.headers['upgrade']?.toLowerCase() === 'websocket';
|
|
25
25
|
|
|
26
26
|
if (isWebSocket) {
|
|
27
|
-
//
|
|
28
|
-
// The
|
|
27
|
+
// Modify req.url to remove the apiPrefix before proxying
|
|
28
|
+
// The incoming request is /api/chat/test-room but backend expects /chat/test-room
|
|
29
|
+
// Don't restore since proxy.web() is async
|
|
30
|
+
event.node.req.url = rawPath;
|
|
31
|
+
|
|
32
|
+
// For WebSocket, use http-proxy directly
|
|
29
33
|
proxy.web(event.node.req, event.node.res, {
|
|
30
|
-
target:
|
|
34
|
+
target: config.public?.enfyraSDK?.apiUrl || process.env.API_URL || 'http://localhost:1105',
|
|
31
35
|
ws: true,
|
|
32
36
|
changeOrigin: true,
|
|
33
37
|
headers,
|