8

I have Dokku installed on a server, with multiple sites/domains deployed to it. When one of my sites goes down, all HTTP requests to it get redirected (for some reason) to another site. This is confusing. I'm expecting Dokku to show some error page in this case. Is it the default behavior or I did something wrong?

PS. This is the problem: https://github.com/dokku/dokku/issues/2602

yegor256
  • 102,010
  • 123
  • 446
  • 597
  • 1
    it seems the [network module has `rebuildall`](http://dokku.viewdocs.io/dokku/networking/network/#rebuilding-all-network-settings) command that will sorta do what you're after. I presume you have tried calling that on site restart? – timur Mar 16 '20 at 14:03
  • `rebuildall` doesn't help, since it relies on network settings already in the system. I need some method of keeping the same IP address assigned to the app, no matter how many times I restart it – yegor256 Apr 21 '20 at 16:04
  • The only thing that helps is `dokku nginx:update-config`, as suggested [here](https://github.com/dokku/dokku/issues/3152#issuecomment-379814489) – yegor256 Apr 21 '20 at 16:14

1 Answers1

0

How about adding a custom error page based on the error code by editing vhost file:

server{
    server_name www.foo.com;
    root    /srv/www/foo/public_html;
    expires     1M;
    access_log  /srv/www/foo/logs/access.log;
    error_log   /srv/www/foo/logs/error.log;

    error_page 404 /404.html;

    location / {
        index   index.html;
        rewrite ^/(.*)/$ /$1 permanent;
        try_files "${uri}.html" $uri $uri/ =404;
    }

    location = /404.html {
        internal;
    }       
}

Your server error might be caught from codes 404 or 500

Nilanka Manoj
  • 3,527
  • 4
  • 17
  • 48