-
Hi, we have a Trame web app deployed in Docker using the Cookiecutter example. The app is accessible through a nginx reverse proxy with basic authentication enabled to control client access. Once the client is connected, I would like to use their username to filter the data displayed in the Trame app. So far, I have successfully added the username to the HTTP headers sent by the proxy to the web app, but I haven't managed to access it from the app itself. Is there a way to access the HTTP request from the Trame app? Or do you see simpler approach to retrieve the username directly within the app? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You will need to retrieve those from the JS side and let the JS tell trame who is logged in. Technically trame only care of its websocket so no http header. On the other end, you could add a new endpoint where you can inspect the http header. You will just need the client to make a request on that endpoint using that path when deployed in docker HTH |
Beta Was this translation helpful? Give feedback.
-
Thank you! To anyone who might be interested, I adapted this example to create a custom endpoint and print the http headers sent by the proxy. Here the resulting code:
|
Beta Was this translation helpful? Give feedback.
You will need to retrieve those from the JS side and let the JS tell trame who is logged in. Technically trame only care of its websocket so no http header. On the other end, you could add a new endpoint where you can inspect the http header. You will just need the client to make a request on that endpoint using that path when deployed in docker
/api/{sessionId}/endpoint
.HTH