Well, there is not much to it:
1. Get cookie from request: Req:get_cookie_value(?COOKIE)
2. Reply of some sort 302 in this case with Set-Cookie in the header:
Req:respond({302, [{"Location", Location},
{"Content-Type", "text/html; charset=UTF-8"},
mochiweb_cookies:cookie(?COOKIE,
Cookie, [{path, "/"}])
], ""})
3. Same as above but expire the cookie:
Req:respond({302, [{"Location", "/"},
{"Content-Type", "text/html; charset=UTF-8"},
mochiweb_cookies:cookie(?COOKIE, "expired",
[{path, "/"}, {max_age, 0}])
], ""}).
Anton