当前位置:网站首页>RestTemplate多个认证信息Authorization问题
RestTemplate多个认证信息Authorization问题
2022-06-21 18:14:00 【GodSure0914】
业务场景,自己通过程序拼接了一个请求头,然后将请求头放到HttpHeaders通过RestTemplate调用出口网关,接口测试时通过swagger调用是完全没有问题的,但是一发到服务器然后通过程序调用就会报错
通过日志可以看到,这里报的是json转换错误,但是通过log日志发现入参以及我自己拼接的Authorization均没有问题,最后在出口网关打印日志发现restTemplate在请求时传了两个Authorization过去,而网关只拿了第一个做解析,出现问题的原因是因为浏览器本身是有一个认证信息的,java代码在赋值这个认证信息的时候用了HttpHeaders 的add方法,而add方法是基于原本的信息增加的,所以网关解析的时候解析的只是浏览器的那一段,最终导致报错,将add改成set之后问题解决,最坑的是通过swagger本地调用根本发现不了这个问题!!!


边栏推荐
- API interface for discharge summary identification - medical bill OCR identification / discharge diagnosis record / electronic medical record / claim settlement service
- gorm数据库是否需要设置外键
- Kubernetes 跨 StorageClass 迁移 Persistent Volumes 完全指南
- 508. Most Frequent Subtree Sum
- Tableapi & SQL and example module of Flink
- R语言使用epiDisplay包的followup.plot函数可视化多个ID(病例)监测指标的纵向随访图、使用line.col参数自定义曲线的颜色(色彩)
- The R language uses rbind The fill function vertically merges dataframe data of two different data columns
- 剑指 Offer II 029. 排序的循环链表
- 基于k近邻的MNIST图像分类对比
- Two problems that may occur in the use of ThreadLocal and thread pool
猜你喜欢

Startup mode of Jupiter notebook and related problems

How to temporarily modify samesite=none and secure in Chrome browser

Gradle下载与安装配置

Introduction to setting program icon in QT

API interface for discharge summary identification - medical bill OCR identification / discharge diagnosis record / electronic medical record / claim settlement service

如何在Chrome浏览器中模拟请求或修改请求的域名

将图片背景设置为透明的方法介绍

如何在Chrome浏览器中临时修改SameSite=None和Secure

Whether Gorm database needs to set foreign keys

Kubernetes 跨 StorageClass 迁移 Persistent Volumes 完全指南
随机推荐
【面试高频题】难度 1.5/5,经典「前缀和 + 二分」运用题
谷歌浏览器80版本以后,如何处理出现的问题SameSite跨域问题
Nepal graph has settled in Alibaba cloud computing nest to help enterprises build a super large-scale map database on the cloud
如何在Chrome浏览器中临时修改SameSite=None和Secure
How to temporarily modify samesite=none and secure in Chrome browser
TensorFlow 2:使用神经网络对Fashion MNIST分类并进行比较分析
A simple architecture design logic | acquisition technology
Excel文件加密的两种方式
一种简单的架构设计逻辑|得物技术
Manjaro installs the downloaded TTF font file
动态规划【一】(背包问题)
系统集成项目管理工程师(软考中级)怎么备考?
Codeforces Round #394 (Div. 2) E. Dasha and Puzzle
Novice uses apiccloud visual development to build the mall home page
谷粒学院P40~43
在Qt中设置程序图标的方法介绍
Sword finger offer II 029 Sorted circular linked list
SQL operation: with expression and its application
机器学习之神经网络与支持向量机
机器学习之聚类和降维与度量技术