进行Mercure / hub分发使用symfony 4.4进行更新可以正常工作,直到我不尝试将凭据与mercureAuthorization cookie一起使用。
一旦我在EventSource中添加{withCredentials:true},firefox就会以“ CORS missing”(而chrome没有)启动事件源请求连接
'same origin' policy don't allow consulting 'http://localhost:3000/.well-known/mercure ... ' Reason: CORS header 'Access-Control-Allow-Origin' missing
另外,我应该将mercureAuthorization cookie从我的页面请求传递到事件源请求,但事实并非如此。
这是我的主页cookie:
Set-Cookie: mercureAuthorization=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJtZXJjdXJlIjp7InN1YnNjcmliZSI6WyJodHRwOlwvXC9ub3RpZnkuY29tXC9wYXJhbmdvblwvdGVhbSJdfX0.e5YOGcOx-s-8nn2lbseqcVlk18dVEvgZIoKrDCEureA; path=/.well-known/mercure; httponly; samesite=strict;
我的事件源请求
Request URL: http://localhost:3000/.well-known/mercure?topic=http://notify.com/
没有Set-Coockie内部。
编辑:我终于设法通过在同一个域上进行修复! 所以知道我用以下命令运行Mercure服务器:
--adress:'www.mydomain.test:3000/.well-known/mercure ... '
发布
'www.mydomain.test/' for exemple
Set-Cookie:
'return new Cookie('mercureAuthorization', $token,
(exp) 0,
(path) '/.well-known/mercure',
(domain) null,
(secure) false,
(httponly) true,
(raw) false,
(same-site) 'Strict'
);'