
我有一個客戶端可以調用的 api 路由,讓我們調用它/test
現在在該/test
路由中,我想調用/auth
路由來驗證身份驗證部分,在/auth/
塊的側面有一個調用的另一個身份驗證 api,http://app:5000/give_401
它返回 1.401
和JSON 回應或 2和200
json 回應 如果回應代碼是401
,那麼無論收到什麼 json 回應,都必須傳送到客戶端,否則,它可以遵循正常路徑。這是我的nginx.conf
文件。
提前致謝。
events {
worker_connections 1000;
}
http {
server {
listen 80;
location /auth/ {
proxy_pass http://app:5000/give_401;
}
location /test {
auth_request /auth/;
proxy_pass http://app:5000/ok;
}
}
}