我使用nginx x-accel-redirect作为外部资源的身份验证前端。在
在python代码中,我将执行以下操作:
/getresource/def view(self, req, resp):
name = get_name(req.user.id) # authenticates request.
resp.set_header('X-Accel-Redirect', '/resource/%s/' %name )
这也会将HTTP方法转发到nginx1.10。
由于nginx1.10,所有x-accel-redirect都作为GET方法转发。在
我知道转发HTTP方法的正确方法是使用命名位置。
我找不到关于该如何做的文件。
我尝试了以下方法:
^{pr2}$
但这会重定向到“@resource/”。在
我想重定向到“@resource/name”。在
但还没有回应。在
编辑:
发布nginx的配置location /getresource {
proxy_pass http://127.0.0.1:8000;
}
location /resource {
internal;
proxy_pass http://127.0.0.1:8888;
}
location @resource {
internal;
proxy_pass http://127.0.0.1:8888;
}