reactjs - 如何修复 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 文档,但找不到此堆栈的配置。
解决方案
推荐阅读
- nginx - 在 GKE 上配置 nginx 默认使用入口身份验证?
- firebase - 将 Firebase Crashlytics 数据部分导出到 BigQuery
- tensorflow - TensorFlow & Keras 预测阈值
- reactjs - 在 Canvas PowerApp 中管理 PCF 代码组件上的“属性”选项卡
- java - SQlite 数据库未按日期排序
- c++ - C++ Autoclicker 不退出循环
- c++ - 放置 new 和 uninitialized_fill() 的行为
- pygame - 如何解决精灵移动速度过快的问题
- apache-flink - 在独立 flink 集群(Apache flink 1.9.0)上运行 apache Beam 字数统计示例时出错
- spring - 获取 org.springframework.beans.factory.BeanCreationException:使用名称创建 bean 时出错