mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-02-03 18:06:02 -05:00
when developing on Safari, strip HttpOnly
This might be necessary in the production/https case too. But try this first.
This commit is contained in:
parent
478323ec62
commit
d7f4b255bf
@ -21,13 +21,24 @@ module.exports = (app) => {
|
||||
// this attribute in the proxy with code from here:
|
||||
// https://github.com/chimurai/http-proxy-middleware/issues/169#issuecomment-575027907
|
||||
// See also discussion in guide/developing-ui.md.
|
||||
//
|
||||
// Additionally, Safari appears to (sometimes?) prevent http-only cookies
|
||||
// (meaning cookies that Javascript shouldn't be able to access) from
|
||||
// being passed to WebSocket requests (possibly only when not using
|
||||
// https/wss). Also strip HttpOnly when using Safari.
|
||||
// https://developer.apple.com/forums/thread/104488
|
||||
onProxyRes: (proxyRes, req, res) => {
|
||||
const sc = proxyRes.headers["set-cookie"];
|
||||
if (Array.isArray(sc)) {
|
||||
proxyRes.headers["set-cookie"] = sc.map((sc) => {
|
||||
return sc
|
||||
.split(";")
|
||||
.filter((v) => v.trim().toLowerCase() !== "secure")
|
||||
.filter(
|
||||
(v) =>
|
||||
v.trim().toLowerCase() !== "secure" &&
|
||||
(v.trim().toLowerCase() !== "httponly" ||
|
||||
!req.headers["user-agent"].includes("Safari"))
|
||||
)
|
||||
.join("; ");
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user