@makeswift/runtime 0.2.5 → 0.2.6

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/index.es.js CHANGED
@@ -967,7 +967,7 @@ class Document$1 extends NextDocument {
967
967
  });
968
968
  }
969
969
  }
970
- const version = "0.2.5";
970
+ const version = "0.2.6";
971
971
  function MakeswiftApiHandler(apiKey, { appOrigin = "https://app.makeswift.com", getFonts } = {}) {
972
972
  const cors = Cors({ origin: appOrigin });
973
973
  const previewModeProxy = createProxyServer();
@@ -1035,7 +1035,10 @@ Read more here: https://nextjs.org/blog/next-12-2#on-demand-incremental-static-r
1035
1035
  if (host == null)
1036
1036
  return res.status(400).send("Bad Request");
1037
1037
  const forwardedProto = req.headers["x-forwarded-proto"];
1038
- const proto = typeof forwardedProto === "string" ? forwardedProto : "http";
1038
+ const isForwardedProtoHttps = typeof forwardedProto === "string" && forwardedProto === "https";
1039
+ const forwardedSSL = req.headers["x-forwarded-ssl"];
1040
+ const isForwardedSSL = typeof forwardedSSL === "string" && forwardedSSL === "on";
1041
+ const proto = isForwardedProtoHttps || isForwardedSSL ? "https" : "http";
1039
1042
  let target = `${proto}://${host}`;
1040
1043
  if (process.env["NODE_ENV"] !== "production") {
1041
1044
  const port = req.socket.localPort;