Merge pull request #1602 from nextcloud/ignore-mod-env
Add system config htaccess.IgnoreFrontController for prettyURLs w/o mod_env
This commit is contained in:
commit
8ec2e34576
|
@ -407,6 +407,17 @@ $CONFIG = array(
|
|||
*/
|
||||
'htaccess.RewriteBase' => '/',
|
||||
|
||||
/**
|
||||
* For server setups, that don't have `mod_env` enabled or restricted (e.g. suEXEC)
|
||||
* this parameter has to be set to true and will assume mod_rewrite.
|
||||
*
|
||||
* Please check, if `mod_rewrite` is active and functional before setting this
|
||||
* parameter and you updated your .htaccess with `occ maintenance:update:htaccess`.
|
||||
* Otherwise your nextcloud installation might not be reachable anymore.
|
||||
* For example, try accessing resources by leaving out `index.php` in the URL.
|
||||
*/
|
||||
'htaccess.IgnoreFrontController' => false,
|
||||
|
||||
/**
|
||||
* The URL of your proxy server, for example ``proxy.example.com:8081``.
|
||||
*/
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*
|
||||
* @author Bart Visscher <bartv@thisnet.nl>
|
||||
* @author Bernhard Posselt <dev@bernhard-posselt.com>
|
||||
* @author Felix Anand Epp <work@felixepp.de>
|
||||
* @author Joas Schilling <coding@schilljs.com>
|
||||
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
|
||||
* @author Lukas Reschke <lukas@statuscode.ch>
|
||||
|
@ -71,7 +72,7 @@ class Router implements IRouter {
|
|||
public function __construct(ILogger $logger) {
|
||||
$this->logger = $logger;
|
||||
$baseUrl = \OC::$WEBROOT;
|
||||
if(!(getenv('front_controller_active') === 'true')) {
|
||||
if(!(\OC::$server->getConfig()->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) {
|
||||
$baseUrl = \OC::$server->getURLGenerator()->linkTo('', 'index.php');
|
||||
}
|
||||
if (!\OC::$CLI) {
|
||||
|
|
|
@ -207,7 +207,7 @@ class JSConfigHelper {
|
|||
'versionstring' => \OC_Util::getVersionString(),
|
||||
'enable_avatars' => $this->config->getSystemValue('enable_avatars', true) === true,
|
||||
'lost_password_link'=> $this->config->getSystemValue('lost_password_link', null),
|
||||
'modRewriteWorking' => (getenv('front_controller_active') === 'true'),
|
||||
'modRewriteWorking' => (\OC::$server->getConfig()->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'),
|
||||
]),
|
||||
"oc_appconfig" => json_encode([
|
||||
'core' => [
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
||||
*
|
||||
* @author Bart Visscher <bartv@thisnet.nl>
|
||||
* @author Felix Anand Epp <work@felixepp.de>
|
||||
* @author Joas Schilling <coding@schilljs.com>
|
||||
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
|
||||
* @author Lukas Reschke <lukas@statuscode.ch>
|
||||
|
@ -93,7 +94,7 @@ class URLGenerator implements IURLGenerator {
|
|||
* Returns a url to the given app and file.
|
||||
*/
|
||||
public function linkTo( $app, $file, $args = array() ) {
|
||||
$frontControllerActive = (getenv('front_controller_active') === 'true');
|
||||
$frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true');
|
||||
|
||||
if( $app != '' ) {
|
||||
$app_path = \OC_App::getAppPath($app);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* @author Christoph Wurst <christoph@owncloud.com>
|
||||
* @author Clark Tomlinson <fallen013@gmail.com>
|
||||
* @author cmeh <cmeh@users.noreply.github.com>
|
||||
* @author Felix Anand Epp <work@felixepp.de>
|
||||
* @author Florin Peter <github@florin-peter.de>
|
||||
* @author Frank Karlitschek <frank@karlitschek.de>
|
||||
* @author Georg Ehrke <georg@owncloud.com>
|
||||
|
@ -1076,7 +1077,7 @@ class OC_Util {
|
|||
}
|
||||
}
|
||||
|
||||
if(getenv('front_controller_active') === 'true') {
|
||||
if(\OC::$server->getConfig()->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true') {
|
||||
$location = $urlGenerator->getAbsoluteURL('/apps/' . $appId . '/');
|
||||
} else {
|
||||
$location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/');
|
||||
|
|
|
@ -350,6 +350,7 @@ class UtilTest extends \Test\TestCase {
|
|||
|
||||
public function testGetDefaultPageUrlWithRedirectUrlWithoutFrontController() {
|
||||
putenv('front_controller_active=false');
|
||||
\OC::$server->getConfig()->deleteSystemValue('htaccess.IgnoreFrontController');
|
||||
|
||||
$_REQUEST['redirect_url'] = 'myRedirectUrl.com';
|
||||
$this->assertSame('http://localhost'.\OC::$WEBROOT.'/myRedirectUrl.com', OC_Util::getDefaultPageUrl());
|
||||
|
@ -357,6 +358,7 @@ class UtilTest extends \Test\TestCase {
|
|||
|
||||
public function testGetDefaultPageUrlWithRedirectUrlRedirectBypassWithoutFrontController() {
|
||||
putenv('front_controller_active=false');
|
||||
\OC::$server->getConfig()->deleteSystemValue('htaccess.IgnoreFrontController');
|
||||
|
||||
$_REQUEST['redirect_url'] = 'myRedirectUrl.com@foo.com:a';
|
||||
$this->assertSame('http://localhost'.\OC::$WEBROOT.'/index.php/apps/files/', OC_Util::getDefaultPageUrl());
|
||||
|
@ -368,6 +370,14 @@ class UtilTest extends \Test\TestCase {
|
|||
$this->assertSame('http://localhost'.\OC::$WEBROOT.'/apps/files/', OC_Util::getDefaultPageUrl());
|
||||
}
|
||||
|
||||
public function testGetDefaultPageUrlWithRedirectUrlWithIgnoreFrontController() {
|
||||
putenv('front_controller_active=false');
|
||||
\OC::$server->getConfig()->setSystemValue('htaccess.IgnoreFrontController', true);
|
||||
|
||||
$_REQUEST['redirect_url'] = 'myRedirectUrl.com@foo.com:a';
|
||||
$this->assertSame('http://localhost'.\OC::$WEBROOT.'/apps/files/', OC_Util::getDefaultPageUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test needUpgrade() when the core version is increased
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue