Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
Fixed issue where tiles are not loaded if HTTP_X_FORWARDED_PROTO is
Browse files Browse the repository at this point in the history
unset.
  • Loading branch information
mburke-weatheranalytics committed Apr 6, 2017
1 parent 5f314fe commit dc2452e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tileserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ class Server {
*/
public function __construct() {
$this->config = $GLOBALS['config'];

//Get config from enviroment
$envServerTitle = getenv('serverTitle');
if($envServerTitle !== FALSE){
$this->config['serverTitle'] = $envServerTitle;
}
$envBaseUrls = getenv('baseUrls');
if($envBaseUrls !== FALSE){
$this->config['baseUrls'] = is_array($envBaseUrls) ?
$this->config['baseUrls'] = is_array($envBaseUrls) ?
$envBaseUrls : explode(',', $envBaseUrls);
}
$envTemplate = getenv('template');
Expand Down Expand Up @@ -1228,7 +1228,13 @@ public static function serve($routes) {
$request_method = strtolower($_SERVER['REQUEST_METHOD']);
$path_info = '/';
global $config;
$config['protocol'] = ((isset($_SERVER['HTTPS']) or $_SERVER['SERVER_PORT'] == '443') or $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') ? 'https' : 'http';
$xForwarded = false;
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$xForwarded = true;
}
}
$config['protocol'] = ((isset($_SERVER['HTTPS']) or $_SERVER['SERVER_PORT'] == '443') or $xForwarded) ? 'https' : 'http';
if (!empty($_SERVER['PATH_INFO'])) {
$path_info = $_SERVER['PATH_INFO'];
} else if (!empty($_SERVER['ORIG_PATH_INFO']) && strpos($_SERVER['ORIG_PATH_INFO'], 'tileserver.php') === false) {
Expand Down

0 comments on commit dc2452e

Please sign in to comment.