Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configurable error pages #26

Open
jc21 opened this issue Nov 8, 2018 · 22 comments
Open

Add configurable error pages #26

jc21 opened this issue Nov 8, 2018 · 22 comments

Comments

@jc21
Copy link
Member

jc21 commented Nov 8, 2018

It would be nice to allow the user to specify the content for the following pages

  • upstream 404
  • upstream 500
  • upstream unavailable error
  • default page when no matching hostname is configured
@Daxx13
Copy link

Daxx13 commented Dec 12, 2018

default page when no matching hostname is configured

+1 to this, will be a great enhancement.

@fauzie
Copy link

fauzie commented Jan 6, 2019

+1

Waiting for this.

@didusee
Copy link

didusee commented Jan 14, 2019

+1

@ghallford
Copy link

I would like the option to have the default page when no hostname is specified return just a 404 error message. Or just make it so that if anything is hit that is not a valid hostname proxy, it returns a 404 including if the default page is hit from the client using IP of the server in the URL

@tophee
Copy link

tophee commented Oct 25, 2020

+1

Sorry if this is a dumb question, but what is currently the best work around for not exposing that page saying "Congratulations! You've successfully started the Nginx Proxy Manager"? My quick solution was to create a redirect host for my bare IP and redirect to some public website. So Whoever visits my IP will just be bounced back into the internet... :-)

@aosmirnov
Copy link

It would be nice to allow the user to specify the content for the following pages

  • upstream 404
  • upstream 500
  • upstream unavailable error
  • default page when no matching hostname is configured

This feature is really needful!

@Mohan-cloud
Copy link

Mohan-cloud commented Jan 22, 2021

@tophee Is redirection to a public site still the best solution?

@l4rm4nd
Copy link

l4rm4nd commented Nov 17, 2021

@jc21 any updates or plans on this feature enhancement?

@PrzemekSkw
Copy link

+1

Sorry if this is a dumb question, but what is currently the best work around for not exposing that page saying "Congratulations! You've successfully started the Nginx Proxy Manager"? My quick solution was to create a redirect host for my bare IP and redirect to some public website. So Whoever visits my IP will just be bounced back into the internet... :-)

Hello, I also see that Congratulations page on my external IP. Can You tell how to make that redirection?
Regards.

@aosmirnov
Copy link

+1
Sorry if this is a dumb question, but what is currently the best work around for not exposing that page saying "Congratulations! You've successfully started the Nginx Proxy Manager"? My quick solution was to create a redirect host for my bare IP and redirect to some public website. So Whoever visits my IP will just be bounced back into the internet... :-)

Hello, I also see that Congratulations page on my external IP. Can You tell how to make that redirection? Regards.

You should go to settings page in web UI and change Default site settings from Congratulations page to 404 page or Custom HTML or configure a redirection.

@PrzemekSkw
Copy link

Hi, thanks for Your answer. I miss that settings tab. I thougt I have to make someting in command line :D
Thanks.

@anoosa1
Copy link

anoosa1 commented Dec 30, 2021

Any updates? I really need this.

@ririko5834
Copy link

Its good idea to add way to setup custom html error pages for HTTP error codes, for example I want to replace this
image with my own.

@DeltaLaboratory
Copy link

still waiting

@adam-koller
Copy link

same here, waiting.

@kylethedeveloper
Copy link

kylethedeveloper commented Apr 15, 2022

Hi everyone,
I agree that this should be implemented in the UI but until then, I wanted to explain how I managed to do it so that you can too.


Create a directory named error_pages under your /data/nginx/ directory. Prepare your custom error pages and put them in there. These files will be persistent as I suppose that you mount /data directory to your host machine.

After restarting your container; visit the dashboard, edit a proxy host, go to Advanced tab and paste the following with respect to the name of your error page file:

# Error page for 50x
error_page 500 502 503 504  /error-cloud.html;
proxy_intercept_errors on;
location /error-cloud.html {
internal;
root /data/nginx/error_pages;
}

In this case, my error page filename is error-cloud.html where HTTP code is one of 500, 502, 503 or 504.

You can prepare different error pages for different hosts and also different error pages for different response codes. Hope this is helpful.

@webysther
Copy link

webysther commented Sep 16, 2022

Using HttpErrorPages with the solution of @kylethedeveloper:

location / {
    # ... all other configuration
    error_page 400 /error_pages/HTTP400.html;
    error_page 401 /error_pages/HTTP402.html;
    error_page 402 /error_pages/HTTP402.html;
    error_page 403 /error_pages/HTTP403.html;
    error_page 404 /error_pages/HTTP404.html;
    error_page 500 /error_pages/HTTP500.html;
    error_page 501 /error_pages/HTTP501.html;
    error_page 502 /error_pages/HTTP502.html;
    error_page 503 /error_pages/HTTP503.html;
    proxy_intercept_errors on;
}

location /error_pages/ {
    alias /data/nginx/error_pages/;
    internal;
}

This maybe can be the default inside NPM + HttpErrorPages @jc21

@eremid
Copy link

eremid commented Oct 18, 2022

You can add a file server_proxy.conf in your /data/nginx/custom with your content example to set the custom error page globaly :

error_page 400 /error_pages/HTTP400.html;
error_page 401 /error_pages/HTTP402.html;
error_page 402 /error_pages/HTTP402.html;
error_page 403 /error_pages/HTTP403.html;
error_page 404 /error_pages/HTTP404.html;
error_page 500 /error_pages/HTTP500.html;
error_page 501 /error_pages/HTTP501.html;
error_page 502 /error_pages/HTTP502.html;
error_page 503 /error_pages/HTTP503.html;
proxy_intercept_errors on;

location /error_pages/ {
    alias /data/nginx/error_pages/;
    internal;
}

Or comment proxy_intercept_errors on; and just add this directive in the proxy host advanced configuration.

@BobWs
Copy link

BobWs commented Jan 4, 2024

I've added server_proxy.conf to /data/nginx/error_pages/ (- /data/nginx/error_pages/server_proxy.conf) and the html pages but it isn't working! Do I still need to add the above to the advanced tab?

How do I set this globaly in NPM?

@BobWs
Copy link

BobWs commented Jan 5, 2024

Hi everyone, I agree that this should be implemented in the UI but until then, I wanted to explain how I managed to do it so that you can too.

Create a directory named error_pages under your /data/nginx/ directory. Prepare your custom error pages and put them in there. These files will be persistent as I suppose that you mount /data directory to your host machine.

After restarting your container; visit the dashboard, edit a proxy host, go to Advanced tab and paste the following with respect to the name of your error page file:

# Error page for 50x
error_page 500 502 503 504  /error-cloud.html;
proxy_intercept_errors on;
location /error-cloud.html {
internal;
root /data/nginx/error_pages;
}

In this case, my error page filename is error-cloud.html where HTTP code is one of 500, 502, 503 or 504.

You can prepare different error pages for different hosts and also different error pages for different response codes. Hope this is helpful.

How do you prepare different error codes for the same proxy host? e.g. If you want to have an 403 and 502 error page.
And also when I add an image to my custom 502 html error page the image doesn’t show but I use the same html code for the 404 custom page and then the image shows…very weird behavior.

@nickelswitte
Copy link

Is it still planned to integrate this in the future?

@nickelswitte
Copy link

nickelswitte commented May 24, 2024

I've added server_proxy.conf to /data/nginx/error_pages/ (- /data/nginx/error_pages/server_proxy.conf) and the html pages but it isn't working! Do I still need to add the above to the advanced tab?

How do I set this globaly in NPM?

Also, for anyone having the same issue as @BobWs, the server_proxy.conf has to be created in /data/nginx/custom, not any other directory, such as /data/nginx/error_pages. Only then, it is being recognized by NPM.

When I did this, I ran into another error:

nginx: [emerg] "proxy_intercept_errors" directive is duplicate in /data/nginx/custom/server_proxy.conf:10

It seems that this directive has been set somewhere else, and nginx does not accept duplicates. I could fix this by commenting out the ´proxy_intercept_errors on;´and now it is working beautifully.

Hope this helps someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests