请原谅我,如果我问一个糟糕的标准问题,我正在考虑使用Nginx作为我的api的代理层,这是我想要做的事情
NGINX -------- auth request ----> AUTH PROXY
|
| <---200 + Response <------ SUCCESS
|
----> underlying request + Response from auth call ----> BACKEND SERVER
问题是我无法弄清楚如何在nginx auth中添加标头值作为响应
这是我的conf
location / {
auth_request /_auth;
auth_request_set $user <Response Value>;
proxy_set_header x-user $user;
proxy_pass http://backend_server;
}
location = /_auth {
internal;
proxy_pass https://auth;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
}