Internet explorer IE忽略POST中的303重定向->;重定向->;获取场景

Internet explorer IE忽略POST中的303重定向->;重定向->;获取场景,internet-explorer,redirect,http-post,post-redirect-get,Internet Explorer,Redirect,Http Post,Post Redirect Get,我有一个启用OAuth2的站点,它遇到了与IE如何处理303响应相关的问题。在流中,发生3个重定向 ### Chrome/Firefox POST idp.com/login (res 302 -> idp.com/authenticate) GET idp.com/authenticate (res 302 -> app.com/oauth2/callback) GET app.com/oauth2/callback (res 303 -> ap

我有一个启用OAuth2的站点,它遇到了与IE如何处理303响应相关的问题。在流中,发生3个重定向

### Chrome/Firefox
POST idp.com/login           (res 302 -> idp.com/authenticate)
GET  idp.com/authenticate    (res 302 -> app.com/oauth2/callback)
GET  app.com/oauth2/callback (res 303 -> app.com/home)
GET  app.com/home

### IE
POST idp.com/login           (res 302 -> idp.com/authenticate)
POST idp.com/authenticate    (res 302 -> app.com/oauth2/callback)
POST app.com/oauth2/callback (res 303 -> app.com/home)
POST app.com/home
IE似乎出于某种原因保持了原始的请求方法。我试图在我的服务器(app.com)上通过返回一个303来打破最初的POST响应,但这也没有解决问题。这是出乎意料的,因为RFC 2068规定,对于
303-参见其他
响应,应遵守以下规定

对请求的响应可以在 不同的URI,应该使用该URI上的GET方法检索 资源。此方法的存在主要是为了允许 后激活脚本以将用户代理重定向到选定的 资源


我甚至尝试了307回答,但没有成功。有人知道这里发生了什么吗

在LinkedIn OAuth和我的应用程序中遇到了类似的问题,我以一种特别不雅观的方式解决了这个问题。我允许我的回调地址使用POST方法,然后在servlet实现内部将其视为GET调用

    @RequestMapping(value = ApiValues.LINKEDIN_CALLBACK, method = RequestMethod.POST)
public void doPost(HttpServletRequest request, HttpServletResponse response,
        @RequestParam(value = "oauth_token", required = false) String tokenString,
        @RequestParam(value = "oauth_verifier", required = false) String verifierString) throws ServletException, IOException {

    handleCallBack(request, response, tokenString, verifierString);
}


@RequestMapping(value = ApiValues.LINKEDIN_CALLBACK, method = RequestMethod.GET)
public void doGet(HttpServletRequest request, HttpServletResponse response,
        @RequestParam(value = "oauth_token", required = false) String tokenString,
        @RequestParam(value = "oauth_verifier", required = false) String verifierString) throws ServletException, IOException {

    handleCallBack(request, response, tokenString, verifierString);
}

注意:IE(和旧版本的IE)似乎提供了这个问题,Chrome、Firefox和Safari似乎都会重定向以按照规范进行操作。

如果您正在使用IE调试器工具,请不要相信它。网络面板将结合303和302的先前请求(POST)和当前请求(GET)。因此,您将在网络面板中看到一篇帖子,但事实是只有GET请求。尝试使用Charles或其他HTTP监视器工具来检查请求。

在对LinkedIn执行OAuth时看到类似的行为-IE正在发布回调,而不是获取它。相关问题-但仍然没有答案