Category Archives: auth-request

NGINX proxy_pass to another port

I am trying to do an auth_request in nginx by proxy pass but I keep getting:

1 auth request unexpected status: 301

here is my configuration:

server {
    listen      8080;
    server_name  localhost;

    location /my_location/ {
        auth_request /access/auth;
        try_files $uri =404;
    }

    location /access/auth/{
        proxy_pass   http://localhost:5029/server_alias/web_service_name;
        proxy_set_header   Host             $host;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    }

}

The request should be sent to the apache server which is listening on port 5029. What am i doing wrong ?