Status 401 Behaviour Issue

Dayo nginx-forum at
Sat Mar 19 22:03:11 MSK 2011

Hi all.

I noticed a certain behaviour of the 401 status code response I will like to change.

Firstly, in Apache, there is an html page for 401 that is defined in the error_page equivalent. When the request for a protected directory comes in, the user gets the form for the authentication and only if the authentication fails is that html page served.

With Nginx however, if I define an html page error_page for 401, this gets served every time a user requests the protected directory and there is no opportunity to fill in the authentication details.

Is it possible to set it up such that it behaves like Apache does? I.E. only return the html error_page if the authentication fails? This seems like a better implementation to me.

Running 0.8.54


Posted at Nginx Forum:,184007,184007#msg-184007

More information about the nginx mailing list