Comments (11)
前端调用 /api/oauth/anyTenant/login 接口时, 前端设置请求头、经过网关网关也会设置请求头。
但feign 调用时, 请求只会经过 FeignAddHeaderRequestInterceptor 拦截器,FeignAddHeaderRequestInterceptor拦截器不是所有请求头都会传递,具体传递那些,请参考源码中HEADER_NAME_LIST
。 你在调用方,手动设置请求头,/anyTenant/login 接口能正常获取。
from lamp-cloud.
我遇到的问题很奇怪。本地代码运行,没出现问题,打包运行docker就出现获取不到Header中的值。
我这边的调用流程是这样的:A服务Controller中通过feign调用oauth的/anyTenant/login,A服务中request可以获取到Header中的Authorization,但是在oauth中的login方法中通过request获取Header中的Authorization是空值。
from lamp-cloud.
之前用的4.13.2没出现这个问题,升级4.14.0。之后出现了这个问题。
查了一下,只是升级了parent下pom中的相关依赖。并没有改具体的代码。
目前没找到具体的问题,先回退到4.13.2正常使用。
from lamp-cloud.
4.14.0升级了 spring-cloud 相关依赖,不知道会不会影响 FeignAddHeaderRequestInterceptor
from lamp-cloud.
在 FeignAddHeaderRequestInterceptor 中打日志看看有没有执行吧
from lamp-cloud.
目前分析的情况是,新版本中,出错是因为FeignAddHeaderRequestInterceptor 没有执行导致的。暂时没找到具体原因。
from lamp-cloud.
spring-cloud-starter-alibaba-seata 2021.0.5.0 发生了变更,添加了SeataFeignRequestInterceptor,执行了SeataFeignRequestInterceptor没执行FeignAddHeaderRequestInterceptor。导致feign请求没有封装请求头。现回退到2021.0.4.0正常使用。
看了一下最新的2021.1版本,又改回跟 2021.0.4.0相似的结构,去掉了SeataFeignRequestInterceptor。但是引用2021.1版本启动项目会报错。循环依赖,目前现降版本2021.0.4.0使用,后续再研究具体是哪里的原因。
from lamp-cloud.
from lamp-cloud.
目前发现使用2021.0.5.0版本OpenFeignAutoConfiguration没有执行,FeignAddHeaderRequestInterceptor没有自动注册,导致没有执行。
from lamp-cloud.
启动时,OpenFeignAutoConfiguration是否加载取决于:
from lamp-cloud.
from lamp-cloud.
Related Issues (20)
- lamp-cloud如何同时插入三张表的数据 HOT 1
- 删除租户报错 HOT 1
- 企业版lamp-web-pro 4.13.0启动后访问报错 HOT 1
- lamp-boot-pro-datasource-column版本 登录日志和操作日志没有起作用 HOT 2
- ApiSelect HOT 6
- 租户维护:租户已经过了有效期,租户管理员还可以继续登录。 HOT 2
- 邮箱问题 HOT 1
- 创建缓存key时失败 HOT 6
- 将本地的nacos 切换到远程服务器 启动报错 HOT 5
- 项目中切换了数据源 如何在xxl-job中切换数据源 现在是否支持 HOT 1
- docker 构建插件一键生成镜像或者一键部署到centos HOT 1
- getFieldsValue 获取表单数据为空对象
- 使用gateway后性能无法提升 HOT 4
- [技术咨询] 如何集成多个数据库? HOT 2
- 4.x前端请求参数重复 HOT 1
- [security vulnerability]SQL injection
- [sercurity vulnerability]arbitrary file upload HOT 2
- 前端请求接口被缓存 HOT 3
- [security vulnerability]SQL injection
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lamp-cloud.