0

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 ?

Yasmin Reda
  • 385
  • 1
  • 6
  • 18

1 Answers1

2

I found the answer for anyone facing the same problem Only a backslash was missing in auth_request path.

location /my_location/ {
    auth_request /access/auth/;
    try_files $uri =404;
}
Yasmin Reda
  • 385
  • 1
  • 6
  • 18