You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refers to this article, as of Feb, 2020, setting 'samesite=none' in Set-Cookie http response header is necessary for Chrome browser.
I'm working on a react frontend app to a php server powered by symphony right now and the cookie and the cross-site http request is not working.
After testing:
It would work if response header set-cookie is set-cookie: connect.sid=s%3A0dEY7p75z15C_S4zafGq3aEnii6EayEg.nwM4BV%2BKGo8e9y9cMEtfFQZfnAZH51LiliJaPsaAJio; Path=/; HttpOnly; Secure; SameSite=None (tested on express.js)
It WON'T work if response header set-cookie is Set-Cookie: PHPSESSID=t4ejuk7sse0lir5v7juasj28b0; path=/; HttpOnly. (tested on symphony)
Secure; SameSite=None in set-cookie is a must for cross-site http request now.
Reproduce Steps
Run a server with a domain that https enabled(nginx+cloudflare in my case)
server.js(node.js)
//@ts-nocheckimportexpressfrom'express';importsessionfrom'express-session';importcorsfrom'cors';constapp=express();app.set('trust proxy',1);app.use(session({secret: 'keyboard cat',cookie: {secure: true,sameSite: 'none',},}),);app.use(cors({credentials: true,origin: true}));app.get('/',(req,res)=>{if(req.session.test===1){returnres.send('you got session id already it ');}req.session.test=1;returnres.send('just got session');});app.listen(3001,()=>{console.log('listening to 3001');});
You should see just got session at the first request on client then see 'you got session id already it ' on second request since the cookie is attached cross-domain successfully
The Generics type Function(T a) is only allowed one paramter now. Not sure how to improve the type yet.
Usage
$ dart ./main.dart
0
2
4
6
8
main.dart
import'dart:async';
import'./throttle.dart';
voidmain() async {
var f =Throttle.create((int n) {
print(n);
}, duration:constDuration(milliseconds:1000));
for (int i =0; i <10; i++) {
f(i);
awaitFuture.delayed(Duration(milliseconds:500));
}
}