当前位置:网站首页>After the 80 version of Google browser, how to deal with the problem samesite cross domain problem
After the 80 version of Google browser, how to deal with the problem samesite cross domain problem
2022-06-21 19:34:00 【pocher】
Google browser 80 After the version , What happened :
Situation 1 :
If the domain name in the address bar is aaa.com, And the corresponding Ajax So is the request aaa.com, Then you can put aaa.com Under the cookie To any aaa.com Domain name request , such as : Sign in aaa.com When the cookie( hypothesis cookie by token=123), stay Ajax call aaa.com/api/queryUser Interface can be used to cookie Pass on the past , Regardless of the corresponding cookie Is there any setting Secure And SameSite=None.
Situation two :
If the domain name in the address bar is aaa.com, And the corresponding Ajax The request is bbb.com, Then you can put bbb.com Under the cookie To any bbb.com Domain name request , such as : Sign in bbb.com When the cookie( hypothesis cookie by token=123), stay Ajax call bbb.com/api/queryUser Interface can be used to cookie Pass on the past , But the premise is token=123 This cookie You have to set Secure And SameSite=None attribute , Otherwise, even if it is the same domain name cookie It is also undeliverable . Be careful : Here is the address bar aaa.com, What I visited was bbb.com/api/queryUser, Cross domain words , Even with Secure And SameSite=None, You can't do it .

complete Nginx To configure :
upstream tomcat_server {
server 127.0.0.1:8001 weight=10 max_fails=2 fail_timeout=30s;
}
log_format newmain '$remote_addr - "$http_x_forwarded_for" - "$http_j_forwarded_for" - $remote_user [$time_local]'
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" '
'"$gzip_ratio"';
# Current limiting module
limit_req_zone $binary_remote_addr zone=ip_limit_index:20m rate=500000r/s;
server
{
listen 80;
server_name www.xxx.com ;
access_log /export/xxx/nginx/logs/www.xxx.com/www.xxx.com_access.log main;
error_log /export/xxx/nginx/logs/www.xxx.com/www.xxx.com_error.log warn;
error_page 411 = @error_page;
root /export/App/www.xxx.com/;
location / {
set $flag "flag";
# If it is a request to specify a domain name , Set up cross domain
if ($http_origin ~* "(xxx.com|xxx.cn)") {
add_header 'Access-Control-Allow-Origin' "$http_origin";
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Origin,X-Requested-With,Content-Type,Accept,Cache-Control,frLo';
add_header 'Access-Control-Max-Age' 1728000;
}
# If it's a pre inspection request , After setting the cross domain, return directly to
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' "$http_origin";
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Origin,X-Requested-With,Content-Type,Accept,Cache-Control,frLo';
add_header 'Access-Control-Max-Age' 1728000;
# Pre inspection request returned directly
return 200;
}
proxy_next_upstream http_500 http_502 http_503 http_504 error timeout invalid_header;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Set up cookie, Of course, it can also be used for future cookie Additional SameSite=None; Secure To configure
add_header Set-Cookie 'mycookie=xxxx;Path=/;SameSite=None; Secure';
proxy_pass http://tomcat_server;
expires 0;
fastcgi_buffer_size 128k;
fastcgi_buffers 32 32k;
}
# Processing of static resources
location ~ .*\.(css|js|ico)$ {
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_comp_level 3;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript image/jpeg image/gif image/png image/x-icon;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
}
location /logs/ {
autoindex off;
deny all;
}
}
How to be in Chrome Simulate or modify the domain name of the request in the browser
F12 Turn on debug mode , Right click on the request path , then Copy as fetch, open Console TAB , Paste and return , Go back to just now Network On the tab, you can see just now console Request sent in , Of course console You can modify the domain name and the requested parameters .


How to be in Chrome Temporary modification in the browser SameSite=None and Secure

Then tick it
Right click editing SameSite by None,

At this point, even if the page is refreshed, the edited value will not change , Unless the cache is clear or the current session expires . Of course, this is different from Expires/Max-Age The properties of this column are related to , If it is Session The type is restore after the session expires . But this is only a temporary plan .
Nginx newly added cookie:
add_header Set-Cookie 'mycookie=xxxx;Path=/;SameSite=None; Secure';
边栏推荐
- 【面试高频题】难度 1.5/5,经典「前缀和 + 二分」运用题
- Ant group's self-developed tee technology has passed the national financial technology product certification, and 47 tests have met the requirements
- 恒泰证券VIP低佣金开户链接安全的吗?
- 36 krypton launched | focusing on the innovation of health insurance products, and "Yingshi health" has obtained four rounds of financing
- EasyCVR智能边缘网关硬件如何设置通电自启动?
- 【一起上水硕系列】Day One
- MySQL的MVCC实现原理
- From "village run enterprise" to "ten billion group", why did red star industry complete the "butterfly transformation"?
- Cache design issues
- 轻松入门自然语言处理系列 专题6 代码实战──基于语言模型的拼写纠错
猜你喜欢

谷歌浏览器80版本以后,如何处理出现的问题SameSite跨域问题

11 introduction and installation of beautiful soup parsing library

vivo 容器集群监控系统架构与实践

Cache design issues

【一起上水硕系列】Day One

Hongmeng version of "Tiktok" is a great experience

Notes on writing questions in C language -- find s=a+aa+aaa+aaaa+aa Value of a

系统集成项目管理工程师(软考中级)怎么备考?

2022年下半年传统产品经理国际资格认证招生简章(NPDP)
![[Shangshui Shuo series] day one](/img/09/ab31cc494d726e896799d21fa02502.png)
[Shangshui Shuo series] day one
随机推荐
谷歌浏览器80版本以后,如何处理出现的问题SameSite跨域问题
网管型全国产加固交换机如何创建网络冗余
Notes on writing questions in C language -- find s=a+aa+aaa+aaaa+aa Value of a
R语言使用epiDisplay包的dotplot函数通过点图的形式可视化不同区间数据点的频率、使用by参数指定分组参数可视化不同分组的点图分布、使用cex.main参数指定可视化图像标题文本字体的大小
R语言caTools包进行数据划分、randomForest包构建随机森林模型、使用importance函数计算随机森林模型中每个特征的重要度、varImpPlot函数可视化特征的重要度
Ant group's self-developed tee technology has passed the national financial technology product certification, and 47 tests have met the requirements
ThreadLocal与线程池在使用中可能会出现的两个问题
R language uses GLM function to build Poisson regression model, and coef function to obtain the coefficients of Poisson regression model and analyze the effects of various variables
50位中国女性科学家入选2022福布斯
老师们,oracle-cdc遇到不能解析的dml语句,因为这个语句里面有个字段是比较特殊的空间地理位
Nebula Graph入驻阿里云计算巢,助力企业打造云上超大规模图数据库
Excel文件加密的两种方式
R语言使用epiDisplay包的statStack函数基于因子变量通过分层的方式查看连续变量的统计量(均值、中位数等)以及对应的假设检验
GOF mode-03-behavioral mode (bottom)
The R language catiols package divides the data, randomforest package constructs the random forest model, uses the importance function to calculate the importance of each feature in the random forest
华为鸿蒙认证测试题,你能答对几道?
在Qt中设置程序图标的方法介绍
R language uses the statstack function of epidisplay package to view the statistics (mean, median, etc.) and corresponding hypothesis tests of continuous variables in a hierarchical manner based on fa
挖财商学院属于证券公司吗?开户安全吗?
基于ASP.NET开发的企信通源码 短信管理平台源码