manu_dilip_shah
manu_dilip_shah

Reputation: 900

Cookie value is not getting set

I have made a module in nginx to secure cookie.I encrypted the cookie with AES and modified the original cookie with the encrypted value.

If i modify the original cookie with some other value, then its working fine, say i changed cookie value from abc to xyz it works but when i change abc to encrypted abc chrome is not able to save it.

I can see it in the response headers in chrome, but the cookie is not stored by chrome and not sent by chrome for further requests.

Connection:keep-alive
Content-Length:612
Content-Type:text/html
Date:Sun, 15 Feb 2015 14:00:59 GMT
ETag:"54c1c5ae-264"
Last-Modified:Fri, 23 Jan 2015 03:53:18 GMT
Set-Cookie:my_login=2%B9%B2C%BB%E3%B5 }%EA%E8o%DC%B4%BF%F1%BB%BD|%EA%BF%F2K%A4?m7S%88%A7

Also live http headers extension in chrome shows the value of set-cookie as undefined.

HTTP/1.1 200 OK
Accept-Ranges: bytes
Connection: keep-alive
Content-Length: 612
Content-Type: text/html
Date: Sun, 15 Feb 2015 14:00:59 GMT
ETag: "54c1c5ae-264"
Last-Modified: Fri, 23 Jan 2015 03:53:18 GMT
Set-Cookie: undefined

Any insight will be help.Thanks

Upvotes: 0

Views: 474

Answers (1)

Aurangzeb
Aurangzeb

Reputation: 1626

1st, you might need to remove whitespaces

2nd, apparently you're sending cookie in a binary format, which can't be set.

here is a quick solution, encrypt this cookie (further) to base64 before sending it to the browser. That should solve your problem.

Upvotes: 1

Related Questions