You are not logged in.
I have created a server and interface that work well, and my function returns RawJSON output. In that function, I want to send a cookie in the header along with the response.
For this purpose, I used the following code:
var Ctxt: TRestServerURIContext;
Ctxt := CurrentServiceContext.Request;
Ctxt.Call^.OutHead := Trim(Ctxt.Call^.OutHead) + #13#10 + ...
However, it does not appear in the Response Headers section of the browser.
Where is the problem?
Last edited by Kabiri (Today 12:11:03)
Offline
You can try with
Ctxt.OutCookie['myCookie']:='MyValue';
also check httpServer.AccessControlAllowOrigin := ... if cross origin is involved
For cross origin cookie I use
Ctxt.OutCookie['refreshtoken']:=RefToken+'; SameSite=None; Secure; HttpOnly';
Offline
![]()
You can try with
Ctxt.OutCookie['myCookie']:='MyValue';
Thanks a lot, that really helped. It’s working now.
Offline