-
Notifications
You must be signed in to change notification settings - Fork 872
Description
Describe the feature you'd love to see
I have been struggling implementing my use-case and wanted to explain what my needs are to see if there are any thoughts on approaching this differently and have also proposed some minor changes that would help me solve my use-case.
Use Case:
The target system I am proxying has many different domains that are user-configurable, so my users choose which instance they want to work with, and based on this I need to determine which URL to redirect them to.
I also need to set some headers (oauth token) that I have stored in my DB to authenticate with the target system.
I need to query the DB to get the target URL and to get the auth token to add to the headers. I have to perform the DB query twice - once in router
and again in onProxyReq
, and I would prefer to query just once.
Ideally, I would be able to do one of the following:
- Have access to
options
inrouter
so I could update things likeoptions.headers
- Have access to
res
inrouter
so I could gain access to res.locals (this is express specific) - Ability to set the
target
inonProxyReq
where I have full context of everything I would need to do all the work with 1 DB query
Additional context (optional)
No response