gpt4 book ai didi

https - 强制 spring hatoas 生成 https 链接而不是 http

转载 作者:行者123 更新时间:2023-12-04 17:58:53 24 4
gpt4 key购买 nike

我正在使用 spring-boot:1.3.3、spring-hateoas:0.19.0 和 spring-data-rest-core:2.4.4。

{
"_embedded" : {
"projects" : [ {
"status" : "ACTIVE",
"storageRegion" : "US",
"dataSize" : 96850,
"freemiumUnits" : 1,
"_links" : {
"self" : {
"href" : "http://example.com/x-region-us/api/data/projects/2c9f93b755359a4a015535c19b1f0006"
},
"project" : {
"href" : "http://example.com/x-region-us/api/data/projects/2c9f93b755359a4a015535c19b1f0006"
},

这是 spring-hateoas 提供的内容示例。过了一会儿,我将我的应用程序切换到 SSL .

使用时出现问题 traverson.js 通过“_links”跳转(跳跃)。发生错误:

traverson.min.js:2 Mixed Content: The page at 'https://example.com/project-new' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://example.com/x-region-us/api/data/submittalActions'. This request has been blocked; the content must be served over HTTPS.



有没有办法强制spring生成 HTTPS 链接在 HTTP 在json的“_links”部分?

最佳答案

如果您使用 Apache Http Server,则需要在配置文件中添加这一行:

RequestHeader set X-Forwarded-Proto "https"

关于https - 强制 spring hatoas 生成 https 链接而不是 http,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37855319/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com