Welcome! Log In Create A New Profile

Advanced

Re: Custom 401 page not displaying or not prompting for credentials

Maxim Dounin
July 14, 2013 02:56PM
Hello!

On Sat, Jul 13, 2013 at 02:40:14PM +0100, Michael wrote:

> 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.

Access to /401.html requires authentication, which prevents the
error page configured from being returned. Try adding

auth_basic off;

into location /401.html.

--
Maxim Dounin
http://nginx.org/en/donation.html

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Custom 401 page not displaying or not prompting for credentials

Draxter July 13, 2013 09:42AM

Re: Custom 401 page not displaying or not prompting for credentials

Maxim Dounin July 14, 2013 02:56PM

Re: Custom 401 page not displaying or not prompting for credentials

Draxter July 14, 2013 06:34PM

nginx proxy_pass

曾瑞略 July 14, 2013 11:20PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 183
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready