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

Custom Nginx Error Messages? #1325

Closed
dm17 opened this issue Sep 5, 2019 · 4 comments · Fixed by #2430
Closed

Custom Nginx Error Messages? #1325

dm17 opened this issue Sep 5, 2019 · 4 comments · Fixed by #2430

Comments

@dm17
Copy link

dm17 commented Sep 5, 2019

It seems like most people use CDNs for this type of functionality these days, but is there some way to have "site will be back momentarily" sign until all of the nginx-proxy-fed docker services finish starting? This seems like a pretty common use case, so I figured someone here would have a good suggestion or extensions they've written to do this. So if visiting the domain while the services are still coming up - instead of seeing an nginx error (meaningless to most people) - it shows a "please check back in a few moments" message.

I had previous posted this in the wrong project:
nginx-proxy/acme-companion#574

@hasnat
Copy link

hasnat commented Sep 7, 2019

in vhost.d nginx config for your container have something like

        error_page 503 = @custom_error;
        location @custom_error {
                internal;
                return 503 'please check back in a few moments';
        }

not 100% if its 503 or some other error you have to cover.

@dm17
Copy link
Author

dm17 commented Sep 21, 2019

Great, very useful... But how do I get it so the error appears immediately in the browser. If the site isn't up and this gets triggered, then it seems the browser will always display this first:

Attackers might be trying to steal your information from [domain] (for example, passwords, messages, or credit cards). Learn more
NET::ERR_CERT_AUTHORITY_INVALID

Then you have to click twice to proceed.
Maybe you can't do custom errors when there are no vhosts up?

@iNviNho
Copy link

iNviNho commented Sep 23, 2019

@dm17 I dont think you can do anything with that. Browser remembers that site is being loaded over HTTPS and if your site is down/certificate is invalid, user will get this error from browser.

@sgabe
Copy link
Contributor

sgabe commented Feb 16, 2020

Note that you might want to use the proxy_intercept_errors on; directive to intercept and redirect proxied error responses to nginx for processing with the error_page directive in order to prevent information exposure through error messages.

@buchdag buchdag linked a pull request May 2, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants