Answer the question
In order to leave comments, you need to log in
How to use Nginx auth_request?
I read examples on the Internet and NGINX docs about this, but I still can’t implement the authorization system on the channel ...
In location /pub #nginx-push-stream
I
insert
auth_request / auth;
And I make another location:
location = /auth {
internal;
proxy_pass http://www.mysite.ru/ajax_post?act=auth;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
}
function auth(){
if($user_id > 0){
header('Status: 200 OK', true, 200);
exit;
} else {
header('Status: 403 Forbidden', true, 403);
exit;
}
}
Answer the question
In order to leave comments, you need to log in
Try to remove internal;
the rest seems to be ok. If it doesn't work, look at the access logs.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question