Internet Explorer 11 replaces Authorization header

前端 未结 6 2038
北荒
北荒 2020-12-05 02:09

What would cause Internet Explorer to replace the HTTP header

Authorization : Bearer

with

Authorizat

6条回答
  •  无人及你
    2020-12-05 02:54

    In my case, IE alternated between sending a bad request, followed by a good request on a second attempt, then followed by a bad request again and so on.

    After trying several approaches to causing IE to retry - it appears that returning a 307 (Temporary redirect) with the same request url in the Location header solves the issue.

    e.g. for a request to "http://myUrl/api/service/"

    HTTP 307 Temporary Redirect
    Location: http://myUrl/api/service/
    

    IE retries the call with the proper data.

    Edit: This method might be dangerous as it might create an infinite loop. A possible solution to work around it, is to return some counter as part of the url in the Location header and analyze it when receiving the call again.

提交回复
热议问题