0

I am new to nginx server, i am trying to validate all request through auth_request module it is working as expected, but in error page configuration it is not working, I have 2 error page configuration 1 for 401 and 1 for 403

    error_page 401 = @error401;
    location @error401 {
        return 302 /login?state=secure;
    }
   error_page 403 =@error403;
    location = @error403 {
       return 302 /accessDenied;
   }

but when server return 401 it is working perfectly, and when server return 403 then it show default 403 page, i wanted it to land on /accessDenied page. can you please help!!!

2
  • Your error_page 403 is missing a space!! Apr 23, 2018 at 9:28
  • Thanks Richard, i tried with space also but no luck Apr 23, 2018 at 9:52

1 Answer 1

1

I do not have the reputation to comment. The location line for the 403 should not have an equals sign.

i.e. location = @error403 { should be location @error403 {

The syntax for the commands you are using and how to use them (although your usage seems fine) are well summarised here, http://nginx.org/en/docs/http/ngx_http_core_module.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .