Skip to content

Commit

Permalink
handle ssl and proper protocol behind proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
ahilles107 committed Dec 13, 2015
1 parent 4a140ac commit 41a865e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions newscoop/public/index.php
Expand Up @@ -66,6 +66,7 @@

$kernel->loadClassCache();
$request = Request::createFromGlobals();
Request::setTrustedProxies(array($request->server->get('REMOTE_ADDR')));
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
Expand Up @@ -44,6 +44,11 @@ public function indexAction(Request $request)
$application = \Zend_Registry::get('zend_application');
$bootstrap = $application->getBootstrap();

// set https on when it's ssl
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$_SERVER['HTTPS'] = 'on';
}

$front = $bootstrap->getResource('FrontController');
$front->setDefaultControllerName('legacy');
$front->returnResponse(true);
Expand Down

0 comments on commit 41a865e

Please sign in to comment.