Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to forward headers on HTTP redirect

I'm writing a webapp that responses 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 request:

POST /insertion HTTP/1.1
Content-Length: 9

(content)

Webapp response:

HTTP/1.x 302 Found
Location: /dock
Mydata: asdf

Next client request:

GET /dock HTTP/1.1
Mydata: asdf

Update: It seems I wasn't clear on the matter. I know cookies would be useful, but I can't use them. Do you know whether exists something like what i'm searching for?

like image 701
AticusFinch Avatar asked Dec 28 '09 14:12

AticusFinch


2 Answers

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

like image 197
Darin Dimitrov Avatar answered Nov 03 '22 22:11

Darin Dimitrov


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
like image 26
iamamac Avatar answered Nov 03 '22 22:11

iamamac