Behavior of Unavailable Domains not working properly  [SOLVED]

Have you discovered a bug? Tell us about it.
Post Reply
Grts
Posts: 5
Joined: Fri 9. Jul 2021, 21:33

Behavior of Unavailable Domains not working properly  [SOLVED]

Post 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.
User avatar
Tobi
Community Moderator
Posts: 2812
Joined: Thu 5. Jan 2017, 13:24

Re: Behavior of Unavailable Domains not working properly

Post 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.
Gruß,
Tobi


-----------------------------
wewoco.de
Das Forum für Reseller, Digital-Agenturen, Bildschirmarbeiter und Mäuseschubser
Grts
Posts: 5
Joined: Fri 9. Jul 2021, 21:33

Re: Behavior of Unavailable Domains not working properly

Post 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?
User avatar
Alexander
Keyweb AG
Posts: 3810
Joined: Wed 20. Jan 2016, 02:23

Re: Behavior of Unavailable Domains not working properly

Post 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 *
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
Grts
Posts: 5
Joined: Fri 9. Jul 2021, 21:33

Re: Behavior of Unavailable Domains not working properly

Post 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.
User avatar
Alexander
Keyweb AG
Posts: 3810
Joined: Wed 20. Jan 2016, 02:23

Re: Behavior of Unavailable Domains not working properly

Post 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.
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
Alexander
Keyweb AG
Posts: 3810
Joined: Wed 20. Jan 2016, 02:23

Re: Behavior of Unavailable Domains not working properly

Post 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>
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
Post Reply