egg icon indicating copy to clipboard operation
egg copied to clipboard

egg在post接口中重定向出现options,导致重定向失败

Open dmodaii opened this issue 8 years ago • 3 comments

  • 在post请求的controller中准备重定向到这个url
    • 直接用postman发post请求可以正常重定向,在前端ajax不行
    • get请求都可以
      const setLoginState = await this.service.portal.portal.getLoginState()
      this.ctx.redirect(setLoginState);
  • 前端的console 重定向为什么会产生options请求方式 image.png

  • 各位在egg.js中post请求中怎么重定向的啊,

dmodaii avatar Mar 21 '18 16:03 dmodaii

如果是 cnode 那个问题的话,朴老师已经回答了,ajax 里面怎么 redirect

atian25 avatar Mar 21 '18 16:03 atian25

@atian25 请问能给个链接吗, 没搜到, 谢谢

dmodaii avatar Mar 21 '18 16:03 dmodaii

https://cnodejs.org/topic/5ab21e76ce4a27f867527305

这不就是你么?

你的请求是 ajax ?

atian25 avatar Mar 21 '18 16:03 atian25