小编Max*_*x L的帖子

从 auth_request 缓存令牌

我想从我的请求标头字段授权中缓存令牌。

Authorization : Bearer abcdefghijklmnopqrstuvwxyz

我的目标是,我不必验证验证服务器上的每个请求。如果 Authorization-Token 被缓存(并且有效),那么请求应该在没有验证的情况下调用 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 "";

        }
Run Code Online (Sandbox Code Playgroud)

这是我的设置,但这不起作用。

我希望你能帮助我。

你好!

caching nginx token auth-request

5
推荐指数
1
解决办法
2485
查看次数

标签 统计

auth-request ×1

caching ×1

nginx ×1

token ×1