如何在nginx.conf中的proxy_pass之前调用内省api?

时间:2019-07-26 07:02:32

标签: nginx lua

我想为我在nginx.conf中定义的任何API中获得的所有请求运行自省api。 在将控制权传递给proxy_pass之前,我想将自省API获得的响应集成到标头中。我该如何实现?

upstream authen {
    server IP:PORT max_fails=1 max_conns=100 fail_timeout=10;
    server IP:PORT max_fails=1 max_conns=100 fail_timeout=10 backup;
    keepalive 100;
}

location /shopapi {
 // Here I want to call another location say /auth
 proxy_pass http://localhost:4100/shopapi
}

location /auth {
   proxy_pass     https://authen/as/introspect.oauth2
  // take response from this pass and integrate to header of 
original request.
}

0 个答案:

没有答案