Атрибут полифилл SameSite cook ie - PullRequest
0 голосов
/ 29 января 2020

Есть ли способ заполнить атрибут SameSite cook ie, чтобы я мог использовать эту функцию с устаревшими браузерами или более старыми версиями указанного c браузера?

https://caniuse.com/#feat = то же самое -site-повар ie * 1005 атрибута по *

1 Ответ

1 голос
/ 29 января 2020

Я думаю, мне нужно решить это в обратном прокси:

const express = require('express');
const cp = require('cookie-parser');
const app = express();
app.use(cp());

app.get('/set', (req, res) => {
  // Set the new style cookie
  res.cookie('3pcookie', 'value', { sameSite: 'none', secure: true });
  // And set the same value in the legacy cookie
  res.cookie('3pcookie-legacy', 'value', { secure: true });
  res.end();
});

app.get('/', (req, res) => {
  let cookieVal = null;

  if (req.cookies['3pcookie']) {
    // check the new style cookie first
    cookieVal = req.cookies['3pcookie'];
  } else if (req.cookies['3pcookie-legacy']) {
    // otherwise fall back to the legacy cookie
    cookieVal = req.cookies['3pcookie-legacy'];
  }

  res.end();
});

app.listen(process.env.PORT);

см. https://web.dev/samesite-cookie-recipes/

...