6

Does the HTTP protocol allow a 302 request header to be modified so some parameters can be set and passed to the url receiving the request?

lpdahito
  • 556
  • 2
  • 10
  • 16

1 Answers1

5

302 is a response code, not a request header. The client will resolve the redirect by doing a new request for the new URL, so your client may add whatever headers it want to that new request.

A server wanting some data be sent along to the new URL should do so by appending it to the URL as querystring variables, for example: http://example.com/new-url?variable=data.

If the redirect is happening within your own domain you may also set a cookie which the client may send to the new address. Cookies will only be sent inside the same domain, not if you are redirecting to somewhere else.

Emil Vikström
  • 90,431
  • 16
  • 141
  • 175
  • 1
    The answer at http://stackoverflow.com/a/24296270/632951 claims that the browser is supposed to resend **an identical request** with the exact identical headers that it had sent you. And thus your first redirect to your own domain will include `Set-Cookie`, and when the browser request your 2nd url with the `Cookie` header, you again redirect him to the target web server, and the browser would then send along the repeated `Cookie` header to the target web server. What do you think? – Pacerier Feb 15 '17 at 05:54
  • How to detect 303 response and react to it – yaswanthkoneri Mar 28 '20 at 17:25
  • In my case Iam hitting api, and api is redirecting to other url (303) . Iam getting cors issue due to that, can someone help me fix that? – yaswanthkoneri Mar 28 '20 at 17:37