我想從我的請求頭字段Authorization中緩存令牌。來自auth_request的高速緩存令牌
Authorization : Bearer abcdefghijklmnopqrstuvwxyz
我的目標是,我沒有驗證驗證服務器上的每一個要求。如果授權令牌被緩存(並且有效),則該請求應該在未經驗證的情況下調用API。
location /main {
auth_request /auth;
proxy_ignore_headers Cache-Control;
proxy_pass http://API;
proxy_http_version 1.1;
}
location /auth {
internal;
proxy_cache my_cache;
proxy_ignore_headers Cache-Control;
proxy_cache_key "$http_authorization";
proxy_pass https://validationserver;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
}
這是我的設置,但這不起作用。
我希望你能幫助我。
問候!