Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
316 views
in Technique[技术] by (71.8m points)

收到请求, 为什么 'user-agent' 信息不全,只有Mozilla/4.0

nodejs request 得到的请求数据

console.log(Object.keys(req.headers));
console.log(Object.values(req.headers));

打出来如下
`[ 'host',
'content-type',
'content-length',
'user-agent',
'accept',
'connection',
'pragma' ]
[ 'www.xxq88.cn:3000',
'text/xml',
'607',
'Mozilla/4.0',
'/',
'Keep-Alive',
'no-cache' ]
`

user-agent:Mozilla/4.0

但我抓包发现header 明明有
GET https://lp.open.weixin.qq.com... HTTP/1.1
Host: lp.open.weixin.qq.com

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0

是带有操作系统信息的, 为什么我拿不到?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

你后端取的和前端截的连 Host 都不一样,你确定前端是直接访问的后端接口吗?中间有代理层吧?把请求头都给改了。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...