@inflector/aura 0.8.1 → 0.8.3
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/bin.d.ts.map +1 -1
- package/dist/bin.js +26 -13
- package/package.json +1 -1
package/dist/bin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AA6JA,wBAAgB,KAAK,CAAC,MAAM,UAAQ,QA4CnC;AAiWD,wBAAsB,GAAG,
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AA6JA,wBAAgB,KAAK,CAAC,MAAM,UAAQ,QA4CnC;AAiWD,wBAAsB,GAAG,kBA4DxB"}
|
package/dist/bin.js
CHANGED
|
@@ -582,17 +582,20 @@ export async function dev() {
|
|
|
582
582
|
changeOrigin: true,
|
|
583
583
|
secure: false,
|
|
584
584
|
configure(proxy, _options) {
|
|
585
|
-
proxy.on("proxyReq", (proxyReq
|
|
585
|
+
proxy.on("proxyReq", (proxyReq) => {
|
|
586
586
|
proxyReq.setHeader("Connection", "close");
|
|
587
587
|
if (AURA_KEY) {
|
|
588
588
|
proxyReq.setHeader("Authorization", `Bearer ${AURA_KEY}`);
|
|
589
589
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
590
|
+
});
|
|
591
|
+
proxy.on("proxyRes", (proxyRes) => {
|
|
592
|
+
const cookies = proxyRes.headers["set-cookie"];
|
|
593
|
+
if (cookies) {
|
|
594
|
+
proxyRes.headers["set-cookie"] = cookies.map((cookie) => cookie
|
|
595
|
+
.replace(/;\s*Domain=[^;]*/gi, "")
|
|
596
|
+
.replace(/;\s*Secure/gi, "")
|
|
597
|
+
.replace(/;\s*SameSite=None/gi, "; SameSite=Lax"));
|
|
598
|
+
}
|
|
596
599
|
});
|
|
597
600
|
},
|
|
598
601
|
},
|
|
@@ -649,22 +652,32 @@ async function start() {
|
|
|
649
652
|
body: req.method === "GET" || req.method === "HEAD"
|
|
650
653
|
? undefined
|
|
651
654
|
: req.body,
|
|
652
|
-
signal: req.signal,
|
|
653
655
|
});
|
|
654
656
|
const proxyHeaders = new Headers(proxiedResp.headers);
|
|
655
657
|
proxyHeaders.delete("content-encoding");
|
|
656
658
|
proxyHeaders.delete("content-length");
|
|
659
|
+
const rawCookies = [];
|
|
660
|
+
proxiedResp.headers.forEach((value, key) => {
|
|
661
|
+
if (key.toLowerCase() === "set-cookie")
|
|
662
|
+
rawCookies.push(value);
|
|
663
|
+
});
|
|
664
|
+
if (rawCookies.length > 0) {
|
|
665
|
+
proxyHeaders.delete("set-cookie");
|
|
666
|
+
rawCookies.forEach((cookie) => {
|
|
667
|
+
const cleaned = cookie
|
|
668
|
+
.replace(/;\s*Domain=[^;]*/gi, "")
|
|
669
|
+
.replace(/;\s*Secure/gi, "")
|
|
670
|
+
.replace(/;\s*SameSite=None/gi, "; SameSite=Lax");
|
|
671
|
+
proxyHeaders.append("set-cookie", cleaned);
|
|
672
|
+
});
|
|
673
|
+
}
|
|
657
674
|
return new Response(proxiedResp.body, {
|
|
658
675
|
status: proxiedResp.status,
|
|
659
676
|
statusText: proxiedResp.statusText,
|
|
660
677
|
headers: proxyHeaders,
|
|
661
678
|
});
|
|
662
679
|
}
|
|
663
|
-
catch
|
|
664
|
-
// Client disconnected — no point sending a response
|
|
665
|
-
if (err.name === "AbortError" || req.signal.aborted) {
|
|
666
|
-
return new Response(null, { status: 499 });
|
|
667
|
-
}
|
|
680
|
+
catch {
|
|
668
681
|
return new Response(JSON.stringify({ error: "Upstream Proxy Failed" }), { status: 502, headers: { "Content-Type": "application/json" } });
|
|
669
682
|
}
|
|
670
683
|
}
|