1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 16:26:59 +02:00

Additional improvements to $config->noHTTPS option for support of hostnames

This commit is contained in:
Ryan Cramer
2018-04-20 10:33:43 -04:00
parent bc037f840e
commit 184059b5d6
3 changed files with 39 additions and 5 deletions

View File

@@ -142,6 +142,25 @@ $config->useFunctionsAPI = false;
*/
$config->useMarkupRegions = false;
/**
* Disable all HTTPS requirements?
*
* Use this option only for development or staging environments, on sites where you are
* otherwise requiring HTTPS. By setting this option to something other than false, you
* can disable any HTTPS requirements specified per-template, enabling you to use your
* site without SSL during development or staging, etc.
*
* The following options are available:
* - boolean true: Disable HTTPS requirements globally
* - string containing hostname: Disable HTTPS requirements only for specified hostname.
* - array containing hostnames: Disable HTTPS requirements for specified hostnames.
*
* @var bool|string|array
*
*/
$config->noHTTPS = false;
/*** 2. DATES & TIMES *************************************************************************/

View File

@@ -95,7 +95,7 @@
* @property array $adminThumbOptions Admin thumbnail image options #pw-group-images
* @property array $httpHosts HTTP hosts For added security, specify the host names ProcessWire should recognize. #pw-group-HTTP-and-input
* @property int $maxPageNum Maximum number of recognized paginations #pw-group-URLs
* @property bool $noHTTPS When boolean true, pages requiring HTTPS will not enforce it (useful for dev environments).
* @property bool|string|array $noHTTPS When boolean true, pages requiring HTTPS will not enforce it (useful for dev environments). May also specify hostname (string) or hostnames (array) to disable HTTPS for. #pw-group-HTTP-and-input
*
* @property string $dbHost Database host #pw-group-database
* @property string $dbName Database name #pw-group-database

View File

@@ -45,7 +45,7 @@ class ProcessWire extends Wire {
* Reversion revision number
*
*/
const versionRevision = 98;
const versionRevision = 99;
/**
* Version suffix string (when applicable)
@@ -208,7 +208,7 @@ class ProcessWire extends Wire {
$this->setConfig($config);
$this->load($config);
if($this->getNumInstances() > 1) {
if(self::getNumInstances() > 1) {
// this instance is not handling the request and needs a mock $page API var and pageview
/** @var ProcessPageView $view */
$view = $this->wire('modules')->get('ProcessPageView');
@@ -220,7 +220,7 @@ class ProcessWire extends Wire {
$str = $this->className() . " ";
$str .= self::versionMajor . "." . self::versionMinor . "." . self::versionRevision;
if(self::versionSuffix) $str .= " " . self::versionSuffix;
if($this->getNumInstances() > 1) $str .= " #$this->instanceID";
if(self::getNumInstances() > 1) $str .= " #$this->instanceID";
return $str;
}
@@ -286,7 +286,22 @@ class ProcessWire extends Wire {
/** @noinspection PhpIncludeInspection */
include_once($file);
}
// check if noHTTPS option is using conditional hostname
if($config->noHTTPS && $config->noHTTPS !== true) {
$noHTTPS = $config->noHTTPS;
$httpHost = $config->httpHost;
if(is_string($noHTTPS)) $noHTTPS = array($noHTTPS);
if(is_array($noHTTPS)) {
$config->noHTTPS = false;
foreach($noHTTPS as $host) {
if($host === $httpHost) {
$config->noHTTPS = true;
break;
}
}
}
}
$this->setStatus(self::statusBoot);