server-status-project/server-status

[FEATURE-REQUEST] Hostname should not need to be statically configured in the config

Nothing4You opened this issue · 5 comments

Is your feature request related to a problem? Please describe.
When using different domains for the same page that are not necessarily both accessible to the user at the same time it would be useful to dynamically detect the hostname in use.

Describe the solution you'd like
It could be changed to use domain-relative URLs in most places and the config would only define the base path.
The only place that actually requires a full URL with domain and protocol is the account creation invitation email, which could be built e.g. from $_SERVER["SERVER_PROTOCOL"]."://".$_SERVER["HTTP_HOST"].

Describe alternatives you've considered
-

Was this considered before?
Not as far as I can tell.

Additional context
(Added by team) We are trying example scenarios.

I was thinking about something along the lines of Nothing4You@ba67453

Hi @Nothing4You we have now received your request. We'll consider and respond to you soon.

Just like in WordPress you can simply get around this inside the config file like it is in WordPress.
Something like this should do if you are running it on the root domains.
define("WEB_URL",$_SERVER["SERVER_PROTOCOL"]."://".$_SERVER["HTTP_HOST"]);
And please note that you would still need to remove https redirect from htaccess to use http
Also,
We are still considering but we need more info where it can be usable as this should not be a problem when accessing the page from different domains at the same time.

Pryx commented

My main issue with this is that I don't see the use-case here... Why would anyone host the same content on two different domains? Maybe I'm just missing something? 🙂

I guess I just forgot that PHP allows variables in constant assignments, thanks.

To explain my usecase:
I'm running multiple instances, a public one with more information and a private one with less information.
Depending on whether you're in the internal or external network you get to see the other instance.
To allow management of both they also have a dedicated hostname.