1

I set up OAuth2-proxy as a reverse proxy, providing authentication and authorization for users of a custom web application, deployed as an upstream private service. It all works well. Except that I would like to pass the username from the reverse proxy to the upstream application.

The OAuth2-proxy documentation suggests that username can be passed from the reverse proxy as the HTTP header X-Forwarded-User. But how can my upstream application receive that HTTP header? The upstream application is in Python, so I looked at the requests package, but that package seems to only provide headers for an outbound request made by the application, or the response to that outbound request.

What am I missing?

David Bridgeland
  • 525
  • 1
  • 9
  • 16

1 Answers1

1

Figured it out, with some help from someone on the Render forum.

The HTTP header X-Forwarded-Email carries the user's email from OAuth2-proxy to the upstream application. The upstream application is in Dash, which runs on top of Flask. The headers are available via flask.request.headers.

David Bridgeland
  • 525
  • 1
  • 9
  • 16