1. 首页
  2. 主题
  3. Go问与答

gin 重定向 header 缺失怎么回事?

kyl250 · · 2205 次点击
调试过程 ![捕获1.PNG](https://static.studygolang.com/201009/14e7ec63fbe2644b25dc42f88ccc6599.PNG) 有token header: map[Accept:[text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9] Accept-Encoding:[gzip, deflate, br] Accept-Language:[zh-CN,zh;q=0.9] ** Authorization:[eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjQ2LCJleHAiOjE2MDIyNTM 2NDksImlhdCI6MTYwMjI1MDA0OSwiaXNzIjoic2p5Iiwic3ViIjoidXNlcl90b2tlbiJ9.5UA1BcxUW8lNF5N3RW-zZXJkUc34T1Ale6FCpanQ1LM] ** Cache-Control:[max-age=0] Connection:[keep -alive] Content-Length:[21] Content-Type:[application/x-www-form-urlencoded] Origin:[http://127.0.0.1:8080] Referer:[http://127.0.0.1:8080/login] ![捕获2.PNG](https://static.studygolang.com/201009/ccee90725a17981bca6c5703d23d6491.PNG) token为空 map[Accept:[text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9] Accept-Encoding:[gzip, deflate, br] Accept-Language:[zh-CN,zh;q=0.9] Cache-Control:[max-age=0] Connection:[keep-alive] Referer:[http://127.0.0.1:8080/login] ![捕获3.PNG](https://static.studygolang.com/201009/d3f01abf7221e1c8c130368f2ef8e472.PNG) 路由 求解
盲猜前端重定向的时候没有携带`Authorization`头
#1
更多评论
我没有用前后端分离,没有跨域。是前端也要进行操作吗?没有传递Authorization的方法,让跳转后的页面使用原有的header吗?要怎么解决,我萌新不懂。
#2

用户登录

没有账号?注册

今日阅读排行

    加载中

一周阅读排行

    加载中