The original post: /r/nginx by /u/mr_mgs11 on 2024-10-11 15:46:56.

I am setting up a poc for a piece of software we are demoing. The current implementation (just for PoC) is an nginx container and the software (has web gui) container running on a host in the same bridge network. They want to pass a mock user token to this software, and the docs said setup a reverse proxy in nginx. The person I am setting this up for wanted to curl a rest api that returns the fake user token, then insert that into the traffic going to the software to pass user information for logging and authorization. I assume unless there is forwarding logic on the api server itself, there is no way to forward traffic to the api and then off to software container using just the nginx reverse proxy.

My familiarity with nginx is mainly for simple layer 7 routing between containers. I was looking at the docs to make sure my initial assumption about traffic routing is correct, and thinking of the best way to just put the user token into the forwarded header. The software support team had suggested putting in “proxy_set_header X-ANONYMOUS-USER username;” into the location block as the software has a configuration to grab that header and username to log in, but that isn’t really what I am trying to do. The use case is people logged into our stuff will be automatically logged into this bit of software via that token. What would you all suggest as the best way to set this up?