How to forward headers on HTTP redirect

前端 未结 3 414
灰色年华
灰色年华 2020-11-27 20:35

I\'m writing a webapp that reponses an HTTP redirect. Is there a way to force the client to forward the headers I include in the response to the new url?

Example req

相关标签:
3条回答
  • 2020-11-27 21:12

    Other than HTTP cookies, there's nothing in the protocol specification about forwarding headers. The client needs to implement this functionality.

    0 讨论(0)
  • 2020-11-27 21:21

    This is what cookies are used for. You can set it for the browser session and invalidate it after the next request.

    0 讨论(0)
  • 2020-11-27 21:28

    Put your data in the new url as an argument:

    HTTP/1.x 302 Found
    Location: /dock?data=asdf
    

    or save it in cookies

    HTTP/1.x 302 Found
    Location: /dock
    Set-Cookie: data=asdf
    
    0 讨论(0)
提交回复
热议问题