Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

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

为什么重定向301发送了一个新请求?

node作为后端,这样设置:

    ctx.set('Location', '/register');
    ctx.status = 301;
    ctx.body = 'Redirecting to shopping cart';

前端没有跳到新地址
而是发送了一个请求,而且请求域名也不对(应该是前端的地址,但是这里是服务器的地址)
image
image

更像是一个内部的转发操作

如何解决?


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

1 Answer

0 votes
by (71.8m points)

重定向只能更改请求的地址 不能重定向前端的路由


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