Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop into master #306

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ HOST_IP=host.docker.internal
# If not specified tdb will use the folder "tdb_backup" in your home directory
#TDB_BACKUP_PATH=/your/path/to/backup/location

# Set this to a region close to you for better page loading times when using ngrok
# Available ngrok regions: us (Ohio), eu (Frankfurt), ap (Singapore), au (Sydney), sa (Sao Paulo), jp (Tokyo), in (Mumbai)
NGROK_REGION=au

# Set your preferred shell (used by things like tphp). bash and zsh are available.
INTERACTIVE_SHELL=zsh

# Uncomment this to use mutagen on MacOS (to speed up docker volume syncing)
#USE_MUTAGEN=1

# Build settings (this will have an affect on build only)
TIME_ZONE=Pacific/Auckland

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.use-mutagen
use-mutagen
mutagen.yml.lock
.env
!.gitkeep
Expand Down
6 changes: 1 addition & 5 deletions bin/tngrok
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@ Usage Examples:
exit;
fi

if [ -z $NGROK_REGION ]; then
NGROK_REGION="us"
fi

if [ ! -z $2 ]; then
subdomain="-subdomain=$2"
fi

ngrok http --region=$NGROK_REGION $subdomain --host-header=rewrite "https://$1:8443"
ngrok http $subdomain --host-header=rewrite "https://$1:8443"
32 changes: 9 additions & 23 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,30 +135,16 @@
* You shouldn't need to change this section - but if you find this needs modification to get it working,
* then please contribute what you did back to the docker-dev repository :)
*/
// Ngrok uses a few different URLs, add if a new one is used
$ngrok_urls = array('ngrok-free.app', 'ngrok.app');

// Depending on the Ngrok version its hostname is stored in different server vars
$ngrok_server_vars = array(
$_SERVER['HTTP_X_FORWARDED_HOST'] ?: '',
$_SERVER['HTTP_X_ORIGINAL_HOST'] ?: '',
);

$ngrok_hostname = '';
foreach ($ngrok_server_vars as $server_var) {
if (!empty($server_var) && empty($ngrok_hostname)) {
foreach ($ngrok_urls as $ngrok_url) {
if (strpos($server_var, $ngrok_url) !== false) {
$ngrok_hostname = $server_var;
break;
}
}
}
}

// Turns out request came via Ngrok
if (!empty($ngrok_hostname)) {
$_SERVER['HTTP_HOST'] = $ngrok_hostname;
// Matches URL with ngrok.app or ngrok-free.app
$ngrok_hostname_regex = '/\b(?:ngrok-free\.app|ngrok\.app)\b/';
if (!empty($_SERVER['HTTP_X_FORWARDED_HOST']) && preg_match($ngrok_hostname_regex, $_SERVER['HTTP_X_FORWARDED_HOST'])) {
// Request came via ngrok
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
$CFG->wwwroot = 'https://' . $_SERVER['HTTP_HOST'];
} else if (!empty($_SERVER['HTTP_X_ORIGINAL_HOST']) && preg_match($ngrok_hostname_regex, $_SERVER['HTTP_X_ORIGINAL_HOST'])) {
// Request came via ngrok
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_ORIGINAL_HOST'];
$CFG->wwwroot = 'https://' . $_SERVER['HTTP_HOST'];
} else if (!empty($_SERVER['HTTP_HOST']) && !empty($_SERVER['REQUEST_SCHEME'])) {
// accessing it locally via the web
Expand Down
2 changes: 0 additions & 2 deletions use-mutagen

This file was deleted.