Hi
Eduardo,
Use OnBeforeRequestAdvance event instead of OnBeforeRequest and use Rest_Extender forge component
HttpRequestHandler will set the cookiee in the current context and when you are calling a REST API a new request context is created and that is accessible on OnBeforeRequestAdvance for injecting some custom code.
https://www.outsystems.com/forge/component-overview/3278/rest-extender

Best Regards
Devendra