我正在试图找出是否可以将查询参数从原始的auth_request转发到处理程序/服务?
用户应该能够添加API-token作为查询参数,如:https://example.com/api/user?token=237263864823674238476
而不是通过header或cookie。我可以以某种方式访问auth服务中的token参数吗?还是用NGINX在自定义头中写入token查询参数?
到目前为止已经尝试过了:
location = /api/user {
auth_request /auth;
proxy_set_header X-auth-token-from-query $arg_token;
proxy_pass http://<url>;
}/auth端点不获取X-auth-token-from-query头,但是在返回200之后,上游代理将得到报头。
发布于 2016-05-18 17:33:10
您很可能也希望将url ( uri)传递给auth请求端点。你可以一蹴而就:
location = /api/auth {
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Original-METHOD $request_method;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_pass http://<url>;
}奖励:我也通过了方法!:tada:
https://stackoverflow.com/questions/36454011
复制相似问题