# 使用场景

在 A 域名的页面向 B 域名提交数据时需要代入 B 域名的 cookie,否则 B 域名会跳转到登陆页面。解决方式需要使用到 nginx 反向代理,配置如下:

server {
	listen port ssl http2;
	server_name xxx.com;
	ssl_certificate_key /xxx.key;
	ssl_certificate /xxx.pem;
	proxy_cookie_path ~(.*) "$1; SameSite=None; secure; httponly";

	location / {
		#允许镶套的方式(可以同域镶套、指定域名镶套或者所有域名镶套)
		add_header X-Frame-Options ALLOWALL; #允许被所有域名镶套
		proxy_pass http://xxx;
	}
}