Page 1 of 1

Behavior of Unavailable Domains not working properly  [SOLVED]

Posted: Sun 12. Mar 2023, 14:53
by Grts
Hi,
I'm having a bit of a problem with the "Behavior of Unavailable Domains" configuration.

Server operating system + version
Debian 11

KeyHelp version + build number
23.0 - Build 2921

Problem description / error messages
When navigating to a domain that is not setup in KeyHelp it sends the me to the dashboard login rather than to the "Non-existent domains" setting that I have set in Configuration -> Behavior of Unavailable Domains.

When navigating to a domain that is disabled in KeyHelp it displays "404 Not Found. The requested URL was not found on this server." even though I have tried both to leave it at the default setting and also set a custom URL.

Expected result
Non-existent domain page should be displayed.
Disabled domains should be directed correctly.

Actual result
Non-existent domains: Redirects to control panel login no matter what I set it to in the configuration.
Disabled domains: 404 error no matter its setting.

Additional information
No additional Debian packages installed on the server, this is a fresh install.

Re: Behavior of Unavailable Domains not working properly

Posted: Sun 12. Mar 2023, 17:21
by Tobi
As long as the domain is not yet configured in KeyHelp the normal behaviour is the loginscreen.

This allows you to login to the panel even if the hostname has changed or in case of IP change.

I would say this is a feature and not a bug.

Re: Behavior of Unavailable Domains not working properly

Posted: Sun 12. Mar 2023, 19:14
by Grts
Thanks for the response!
What would you say the purpose of "Behavior of Unavailable Domains" configuration is if not what I expected it to be? What domains are affected by this configuration?

Re: Behavior of Unavailable Domains not working properly

Posted: Mon 13. Mar 2023, 10:32
by Alexander
I can reproduce the issue. Thou i am unsure, why it worked back in the days, when i implemented it.

I have now made several changes to the /etc/apache/keyhelp/keyhelp.conf and this should work for all cases now. I would love to see some feedback on those by the community, to double check that everything is working now and no regression has sneaked into. Than it will be implemented for the upcoming update.
So if anybody will give this new settings a try, that would be awesome.

1) Open /etc/apache/keyhelp/keyhelp.conf

2) Find

Code: Select all

# KeyHelp / Tools
<VirtualHost *:443>
    ServerName YOUR_HOSTNAME
    ServerAdmin YOUR_EMAIL
and change this to the following. Replace IP_1 IP_2 (etc...) with your IPs of the server.

Code: Select all

# KeyHelp / Tools
<VirtualHost *:443>
    ServerName YOUR_HOSTNAME
    ServerAlias IP_1 IP_2
    ServerAdmin YOUR_EMAIL

3) Find

Code: Select all

# Redirect HTTP -> HTTPS
<VirtualHost *:80>
    ServerName YOUR_HOSTNAME
and change this to the following. Replace IP_1 IP_2 (etc...) with your IPs of the server.

Code: Select all

# KeyHelp / Tools
<VirtualHost *:80>
    ServerName YOUR_HOSTNAME
    ServerAlias IP_1 IP_2

4) Find

Code: Select all

# Default page, if domain not available.
<VirtualHost *:443>
    ServerName YOUR_HOSTNAME
    ServerAlias *.YOUR_HOSTNAME
and change this to the following.

Code: Select all

# Default page, if domain not available.
<VirtualHost *:443>
    ServerName YOUR_HOSTNAME
    ServerAlias *

5) Find

Code: Select all

# Default page, if domain not available.
<VirtualHost *:80>
    ServerName YOUR_HOSTNAME
    ServerAlias *.YOUR_HOSTNAME

Code: Select all

# Default page | Redirect HTTP -> HTTPS
<VirtualHost *:80>
    ServerName YOUR_HOSTNAME
    ServerAlias *

Re: Behavior of Unavailable Domains not working properly

Posted: Mon 13. Mar 2023, 11:16
by Grts
It works!
All though every time I make any changes from the dashboard, the "ServerAlias" sets back to "*.hostname" rather than just leaving it at "*".

When I try xyz.hostname it redirects correctly as a non-existent/disabled domain.

I guess you found the bug/issue: When "ServerAlias *.hostname" is set it only affects non-existent/disabled SUBdomains for the actual hostname rather than all non-existent/disabled domains. :-)

Fix: Set ServerAlias to "*" by default.

Re: Behavior of Unavailable Domains not working properly

Posted: Mon 13. Mar 2023, 15:30
by Alexander
Thank you for the feedback (other feedback by other users is still welcome).
Grts wrote:All though every time I make any changes from the dashboard, the "ServerAlias" sets back to "*.hostname" rather than just leaving it at "*".
You may want to temporary set this file immutable ("chattr + i /etc/apache/keyhelp/keyhelp.conf"), until KeyHelp 23.1 is released.

Re: Behavior of Unavailable Domains not working properly

Posted: Thu 16. Mar 2023, 16:12
by Alexander
Stumbled across Apache server status will not work with these changes.

So the following is also required in the keyhelp.conf (put it before "# User vhosts")

Code: Select all

# Apache server status
<VirtualHost *:443>
    ServerName localhost
</VirtualHost>