Custom 401 page not displaying or not prompting for credentials

Michael draxter65 at gmail.com
Sat Jul 13 13:40:14 UTC 2013


Hello, I was trying to set a custom error 401 page on my Nginx server
version 1.5.1 using the following methods:

error_page 401 /401.html
By itself it still displays the default site

error_page 401 http://example.com/401.html
Goes straight to the custom error page without a chance to authenticate

error_page 401 /401.html;
location = /401.html
        {
           root   G:/Files;
           allow all;
Also goes straight to the error page.



My entire config file:

worker_processes 1;

events
{
    worker_connections 1024;
}

http
{
    include mime.types;
    default_type application/octet-stream;
    sendfile on;

    server
    {
        satisfy any;
        allow 192.168.0.0/24;
        deny all;
        auth_basic "Please login";
        auth_basic_user_file C:\password.txt;
        listen 80;
        server_name localhost;
        root G:/Files;

        location /
        {
            index  index.html  index.php /_h5ai/server/php/index.php;
  error_page 401 /401.html;
            location = /401.html
  {
  root G:/Files;
  }
        }
        location ~ \.php$
        {
            include fastcgi.conf;
            fastcgi_pass 127.0.0.1:9000;
        }
    }
}


If anyone has any idea what I'm doing wrong, let me know.

Kind regards,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130713/9a607ffd/attachment.html>


More information about the nginx mailing list