Sending information using HTTP redirection, which should the browser send to the redirected location?

Is this possible ... for example, imagine that I am responding to a request with 302 (or 303) and I tell the browser to execute the request in a specific place .. is there a header that I can send using HTTP 302 so that A subsequent request from the browser included this header?

I know I could do this with a location header, as in a redirect, and specify the information in the url as a query string .. but I am wondering if there is a better way. It seems that this should be a legitimate scenario.

'The content has moved, go here .. oh, and you will want to take it with you to indicate the location of the redirect'

I guess there is no big fat!

Thanks in advance.


Edit

The reason for this is with respect to PRG templates, where you have the GET and POST URLs, given that you are sending data, and this is unacceptable, the server redirects you to GET and does some β€œmagic” in order to β€œsend” data "to this GET, using the most frequent session state to store the variable.

However, this can lead to a failure in the scenarios where many of these PRG requests occur, provided that this is not a common scenario, and in general no one should worry about it .. but if you do, you will need a way to identify the requests, this can be done with query string parameters sent to 302 .. so that a particular record can be placed in session state in accordance with this request.

The question was trying to remove the "key request" from the URL and make it more implicit .. a cookie "appears" to work, but they only make the window for the screws smaller.

It would be great to say, when you specify the "location" indicated by me, send these parameters.


Edit

I just want to note that I'm not trying to force the browser to send arbitrary headers to this place, but if there are ANY headers designed to prompt the context of the request (for example, request parameters).

+6
source share
2 answers

The redirect response itself does not contain any data. You can redirect the URL with the request parameters, but the new "location" should know how to use these parameters.

+9
source

No, It is Immpossible. You cannot force a client to do something. You can just say, "This is not the right place, but try this place." But it does not guarantee that the client will send the same request or another request to this new location. And telling the client to add a specific header field to this subsequent request to a new location is also not possible.

0
source

All Articles