首页 > 解决方案 > 如何修复 Spring Boot - Jhipster 上的 SameSite 问题?

问题描述

我使用 Jhipster 堆栈,Sring Boot 作为后端,React 作为前端。我正在使用 Cloudinary 来托管图像。

问题是每当页面有从 Cloudinaryimg获取的标签src时,chrome 都会显示有关 SameSite 问题的警告。

<img src={'https://res.cloudinary.com/...'} alt={'xxx'} />
Indicate whether to send a cookie in a cross-site request by specifying its SameSite attribute
Because a cookie’s SameSite attribute was not set or is invalid, it defaults to SameSite=Lax, which prevents the cookie from being sent in a cross-site request. This behavior protects user data from accidentally leaking to third parties and cross-site request forgery.
Resolve this issue by updating the attributes of the cookie:
Specify SameSite=None and Secure if the cookie should be sent in cross-site requests. This enables third-party use.
Specify SameSite=Strict or SameSite=Lax if the cookie should not be sent in cross-site requests.
4 cookies
Name    Domain & Path
_mkto_trk   .cloudinary.com/
_gcl_au .cloudinary.com/
_ga .cloudinary.com/
_ga_NKMQJY2D2H  .cloudinary.com/

我尝试搜索 Google 和 Spring Boot 文档、Jhipster 文档,但找不到此堆栈的配置。

标签: reactjsspring-bootcookiesjhipster

解决方案


推荐阅读