Skip to content

Commit b0640bf

Browse files
author
Janos Kasza
committed
Added cookies on top of the response headers
1 parent 7824196 commit b0640bf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

reverse-proxy/app.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ function setCustomHeaders(res, term_name) {
2929
catch (e) {}
3030

3131
res.append("lmi-host-version", snap_version + " " + host_install_source + "." + snap_revision)
32+
res.cookie("lmi-host-version", snap_version + " " + host_install_source + "." + snap_revision)
3233
res.append("lmi-term-name", term_name)
34+
res.cookie("lmi-term-name", term_name)
3335
res.append("lmi-os-name", os_name)
36+
res.cookie("lmi-os-name", os_name)
3437
res.append("lmi-os-arch", os_arch)
38+
res.cookie("lmi-os-arch", os_arch)
3539
res.append("lmi-os-version", distro_version)
40+
res.cookie("lmi-os-version", distro_version)
3641

3742
res.append("Access-Control-Allow-Headers", "lmi-host-version, lmi-term-name, lmi-os-name, lmi-os-arch, lmi-os-version")
3843
}
@@ -48,6 +53,10 @@ app.use(function (req, res, next) {
4853
console.log("Generating RASID");
4954
res.cookie("RASID", crypto.randomBytes(40).toString("hex"));
5055
}
56+
var os_name = req.cookies['lmi-os-name'];
57+
if (os_name === undefined) {
58+
setCustomHeaders(res, "wetty"); // default settings
59+
}
5160
next();
5261
});
5362

0 commit comments

Comments
 (0)