Dokku redirects to another domain when requested site is down
Asked Answered
C

1

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

Conceptualism answered 24/2, 2020 at 7:52 Comment(3)
it seems the network module has rebuildall command that will sorta do what you're after. I presume you have tried calling that on site restart?Euratom
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 itConceptualism
The only thing that helps is dokku nginx:update-config, as suggested hereConceptualism
L
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

Loraineloralee answered 4/4, 2020 at 2:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.