MyBB Community Forums

Full Version: Dynamic usage of http or https
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Currently : we can have http or https, it can‘t be an user choice.

I have a myBB on a free host where certifcate is a self-signed one. I want to allow my user to choose http or https ( i create a poll to choose the forced one).

I try to update settings to allow this.

I update setting.php toi have

$baseUrl = 'http';
if((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) {
  $baseUrl = 'https';
}

…
$settings['bburl'] = "{$baseUrl}://forum.example.com/";
…
$settings['cookiedomain'] = "forum.example.com";
$settings['cookiepath'] = "";
$settings['cookieprefix'] = "";
$settings['cookiesecureflag'] = ($baseUrl == 'https') ? "1" : "0";

His there another solution, i think here if i update settinsg in admin : it delete all this informations …

Maybe i can add it elsewhere ? Or did i need to make a pull request to accept 'dynamic domain en https' ?
(2018-11-26, 08:19 AM)Firnus Wrote: [ -> ]Currently : we can have http or https, it can‘t be an user choice.

I have a myBB on a free host where certifcate is a self-signed one. I want to allow my user to choose http or https ( i create a poll to choose the forced one).

I try to update settings to allow this.

I update setting.php toi have

$baseUrl = 'http';
if((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) {
  $baseUrl = 'https';
}

…
$settings['bburl'] = "{$baseUrl}://forum.example.com/";
…
$settings['cookiedomain'] = "forum.example.com";
$settings['cookiepath'] = "";
$settings['cookieprefix'] = "";
$settings['cookiesecureflag'] = ($baseUrl == 'https') ? "1" : "0";

His there another solution, i think here if i update settinsg in admin : it delete all this informations …

Maybe i can add it elsewhere ? Or did i need to make a pull request to accept 'dynamic domain en https' ?

I have ONE question for you...

Do you have SSL installed for the website?

If not, you must use HTTP.
(2018-11-26, 09:53 PM)Serpius Wrote: [ -> ]I have ONE question for you...

Do you have SSL installed for the website?

If not, you must use HTTP.

I have another question, did you read ?

Quote:I have a myBB on a free host where certifcate is a self-signed one

Thanks …
PS : current system work BUT : upadte any settings in dashboard revert the fix …
(2018-11-27, 01:09 PM)Firnus Wrote: [ -> ]
(2018-11-26, 09:53 PM)Serpius Wrote: [ -> ]I have ONE question for you...

Do you have SSL installed for the website?

If not, you must use HTTP.

I have another question, did you read ?

Quote:I have a myBB on a free host where certifcate is a self-signed one

Thanks …
PS : current system work BUT : upadte any settings in dashboard revert the fix …

Just because you have the SSL certificate signed does not mean it's working correctly.

READ MyBB docs at docs.mybb.com for more information.
There is an older plugin you can probably modify to work for MyBB 1.8.

Your solution of modifying settings.php will be overwritten any time you save settings via the UI.
I'm curious as to why you would want to give the user the option?

SSL's are free nowadays and you should be able to get one of those and should definitely be on globally if available.
(2018-11-27, 04:57 PM)Ben Wrote: [ -> ]I'm curious as to why you would want to give the user the option?

SSL's are free nowadays and you should be able to get one of those and should definitely be on globally if available.

Yea, my thoughts exactly. 

Just put the SSL in and make the whole board HTTPS and be done with it. Why over-complicate things?  Dodgy
It is still non-trivial to obtain a free multi-host certificate (eg. virtual hosts on the same server based on host name). The certificate gets served to the client before the client indicates the host name / domain name. It is an edge case, for sure, but not unheard of.
Free hoster, allowing some adult content : there are not a lot …

i found byet.host : mybb is OK, and allow to move a old (more than 10 years) mybb forum .

Offer only self-signed certificate (WORKING certificate) with free hosting. In general i use Let's Encrypt on my own server.

I set a poll : and some user still want http if ssl is self-signed.

Thank you @laie_techie Smile.