Extract Http Header from Request and save it to a Cookie

Hello everyone. I have this scenario, a container with a React App built as static assets and deployed to production behind a reverse proxy (currently Nginx) that is serving it.

The client wants to add Single Sign On security to this app, and is in charge of making sure that my App is only called by clients that have already logged in and a custom SSO header will be present in the Http requests for my App.

Since the React app is just a bunch of static files, my only "backend" is the reverse proxy, therefore it's the only place where I can access the Http headers and check if the caller is authenticated, and which username and role he/she has. My React App needs such information both for displaying the currently logged in username, and for disabling some buttons if the role has low priviledges.

My current solution is to intercept the Http request custom headers and add them as Cookies via Nginx, then access those Cookies via the React App.

Assuming that this is actually the best practice (I couldn't think of anything else), how can I do this with Traefik? The documentation basically never mentions cookies except for sticky session load balancing, which is kinda out of topic compared to my use case.

Thank you very much,
Roberto