gpt4 book ai didi

java - Kong反向代理后面的Spring Boot(具有安全性)无法正常工作

转载 作者:行者123 更新时间:2023-12-02 11:59:39 30 4
gpt4 key购买 nike

我有一个 Spring Boot 服务,其安全性高于 Keycloak。该服务工作正常:http://localhost:8080/api/resource (受到限制)并且只有在通过 keycloak 进行身份验证后才能访问。

@Override
protected void configure(HttpSecurity http) throws Exception {
super.configure(http);
http.authorizeRequests().antMatchers("/open/*").permitAll()
.anyRequest().authenticated();
}

现在我使用 Kong 作为外部世界的反向代理:其条目是(例如):https://gateway.example.com/customer重定向到 http://localhost:8080

调用 https://gateway.example.com/customer/api/resource 后,出了问题,改为调用https://gateway.example.com/customer/sso/login它调用 https://gateway.example.com/sso/login所以我得到“404 Not Found”。

安全部分似乎已删除或忽略该位置中的“客户”。

可以更正位置吗?

谢谢

最佳答案

如果您使用的是按路径匹配的路由,并且您不会删除该路由,则需要将 strip_path 设置为 true

检查documentation .

关于java - Kong反向代理后面的Spring Boot(具有安全性)无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47360382/

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