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

Categories

0 votes
390 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 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...