@inflector/aura 0.7.1 → 0.7.2

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 CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAmLA,wBAAgB,KAAK,CAAC,MAAM,UAAQ,QAgDnC;AAwJD,wBAAsB,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG,MAAM,iBAqL/C;AAmRD,wBAAsB,GAAG,kBAiFxB"}
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAmLA,wBAAgB,KAAK,CAAC,MAAM,UAAQ,QAgDnC;AAwJD,wBAAsB,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG,MAAM,iBAoL/C;AAmRD,wBAAsB,GAAG,kBAiFxB"}
package/dist/bin.js CHANGED
@@ -391,25 +391,26 @@ export async function serve(mode) {
391
391
  proxy: {
392
392
  "/api": {
393
393
  target: upstreamUrl,
394
- changeOrigin: false, // don't rewrite origin — breaks cookies
394
+ changeOrigin: false,
395
395
  secure: false,
396
396
  ws: true,
397
+ rewrite: (path) => path, // identity — no rewrite, keep as-is
397
398
  configure(proxy) {
398
399
  proxy.on("proxyReq", (proxyReq, req) => {
399
- // Rewrite the path using the raw unmodified URL from the request
400
- proxyReq.path = req.url; // ← keeps the original encoding intact
401
400
  proxyReq.setHeader("connection", "close");
402
401
  if (AURA_KEY)
403
402
  proxyReq.setHeader("Authorization", `Bearer ${AURA_KEY}`);
404
403
  if (req.headers.cookie)
405
404
  proxyReq.setHeader("cookie", req.headers.cookie);
406
405
  });
407
- proxy.on("proxyRes", (proxyRes) => {
408
- // ensure set-cookie is not stripped
409
- if (proxyRes.headers["set-cookie"]) {
410
- proxyRes.headers["set-cookie"] = proxyRes.headers["set-cookie"].map((c) => c
411
- .replace(/; secure/gi, "")
412
- .replace(/; samesite=none/gi, ""));
406
+ proxy.on("error", (err, req, res) => {
407
+ console.error("[proxy error]", err.message, req.url);
408
+ if (!res.headersSent) {
409
+ res.writeHead(502, { "Content-Type": "application/json" });
410
+ res.end(JSON.stringify({
411
+ error: "Proxy error",
412
+ detail: err.message,
413
+ }));
413
414
  }
414
415
  });
415
416
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inflector/aura",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",