1
我试图用nginx
的ngx_http_auth_request_module
以这样的方式:我如何使用外部URI与nginx的的auth_request模块
server {
location/{
auth_request http://external.url;
proxy_pass http://protected.resource;
}
}
它不工作,错误的是:
2017/02/21 02:45:36 [error] 17917#0: *17 open() "/usr/local/htmlhttp://external.url" failed (2: No such file or directory), ...
还是以这种方式与named location
:
server {
location/{
auth_request @auth;
proxy_pass http://protected.resource;
}
location @auth {
proxy_pass http://external.url;
}
}
在这种情况下,错误是阿尔莫ST相同:
2017/02/22 03:13:25 [error] 25476#0: *34 open() "/usr/local/[email protected]" failed (2: No such file or directory), client: 127.0.0.1, server: , request: "GET/HTTP/1.1", subrequest: "@auth", host: "127.0.0.1"
我知道有这样一个办法:
server {
location/{
auth_request /_auth_check;
proxy_pass http://protected.resource;
}
location /_auth_check {
internal;
proxy_pass http://external.url;
}
}
但是,在这种情况下,http://protected.resource
不能使用/_auth_check
路径。
有没有办法将外部URI
作为参数用于auth_request
指令而不重叠http://protected.resource
路由?
如果不是,为什么?
通过静态文件(/usr/local/html
)查找auth_request
的URI看起来有点奇怪。
非常感谢您!我无法在文档中找到它,它在那里吗? –
它不存在,但是也不需要以'/'开头的前缀。 –