I have the need to set a cookie and i'm using this line of code:
Server.Response.Cookie['session-id'] := Server.Session.ID + '; Path=/;';
The server that does this will return the request correctly and in my browser (this is TRtcDataProvider stuff only) i can see the following when i click "Header" i the XHR log:
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Pragma,Content-type
Cache-Control: no-cache,no-store
CONTENT-TYPE: application/json
CONTENT-LENGTH: 201
SET-COOKIE: session-id=7D0E769C233A4D40B719F451DD3566F4; Path=/;
this is all good.
Now, i need to put this server behind a router. So i write a router using RTC and use the example. Strange things are happening with this cookie. Not to start a long discussion, after half a day of confusion i fire up the router demo from the SDK (RTCRouter.exe) and change the outgoing address to
localhost and then i change the port to that which the server is listening to. These are all the changes i have done to the demo (of version 7.18). Click START and run the request.
The response that now comes through the router look like this:
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Pragma,Content-type
Cache-Control: no-cache,no-store
CONTENT-TYPE: application/json
CONTENT-LENGTH: 215
SET-COOKIE: session-id=3D1087C9B14740E784481493F3E1C4C0
SET-COOKIE: Path=/
My "own" router does the exact same thing. I have also tried to remove the space between the first
; and the
P to no avail. The difference between how the response is served obvious. This makes the browser store multiple cookies and mix them up so i'm getting stuck. I have been sifting through sources but can not grasp why the router and client does this when the server does not. Somewhere deep i have seen an object with a delimiter member set to ';' but the router should not use that?
All in all i suppose this is stuff that corresponds to "Cookie attributes" as described here
https://en.wikipedia.org/wiki/HTTP_cookie#Cookie_attributes amongst other places.
Stumped and very grateful for any insights.
Regards,
/Dany