diff --git a/inc/config.php b/inc/config.php index 9568fb0d..aadc4af7 100644 --- a/inc/config.php +++ b/inc/config.php @@ -194,9 +194,8 @@ // Whether or not you can access the mod cookie in JavaScript. Most users should not need to change this. $config['cookies']['httponly'] = true; - // Do not allow logins via unencrypted HTTP. Should only be changed in testing environments or if you connect to a - // load-balancer without encryption. - $config['cookies']['secure_login_only'] = true; + // Do not allow logins via unencrypted HTTP. If your website uses HTTPS, turn this on. + $config['cookies']['secure_login_only'] = false; // Used to salt secure tripcodes ("##trip") and poster IDs (if enabled). $config['secure_trip_salt'] = ')(*&^%$#@!98765432190zyxwvutsrqponmlkjihgfedcba'; diff --git a/inc/functions/net.php b/inc/functions/net.php index ab08c3cb..ebf578e7 100644 --- a/inc/functions/net.php +++ b/inc/functions/net.php @@ -6,5 +6,13 @@ namespace Vichan\Functions\Net; * @return bool Returns if the client-server connection is an encrypted one (HTTPS). */ function is_connection_secure(): bool { - return !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'; + if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') { + return true; + } + elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { + return true; + } + else { + return false; + } } diff --git a/install.php b/install.php index e21e8a30..5fac2eaf 100644 --- a/install.php +++ b/install.php @@ -5,11 +5,6 @@ define('VERSION', '5.2.0'); require 'inc/bootstrap.php'; loadConfig(); -if (!is_writable('inc/secrets.php') || !is_writable('inc/')) { - echo 'install.php does not have permission to write to /inc/secrets.php and/or /inc/, without permission the installer cannot continue'; - exit(); -} - // Salt generators class SaltGen { public $salt_length = 128;