From 813f742c2033789a1b40c5c32f0be0bac9659172 Mon Sep 17 00:00:00 2001 From: Marcel Pociot Date: Wed, 23 Feb 2022 12:43:54 +0100 Subject: [PATCH] Fix redirect issue when using custom domains --- app/Client/Client.php | 2 ++ app/Client/Configuration.php | 17 +++++++++++++++-- composer.json | 8 +++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/app/Client/Client.php b/app/Client/Client.php index b373356..c2a850e 100644 --- a/app/Client/Client.php +++ b/app/Client/Client.php @@ -120,6 +120,8 @@ public function connectToServer(string $sharedUrl, $subdomain, $serverHost = nul $httpProtocol = $this->configuration->port() === 443 ? 'https' : 'http'; $host = $data->server_host ?? $this->configuration->host(); + $this->configuration->setServerHost($host); + $this->logger->info($data->message); $this->logger->info("Local-URL:\t\t{$sharedUrl}"); $this->logger->info("Dashboard-URL:\t\thttp://127.0.0.1:".config()->get('expose.dashboard_port')); diff --git a/app/Client/Configuration.php b/app/Client/Configuration.php index 069861e..68bb2aa 100644 --- a/app/Client/Configuration.php +++ b/app/Client/Configuration.php @@ -6,6 +6,9 @@ class Configuration { /** @var string */ protected $host; + + /** @var string */ + protected $serverHost; /** @var int */ protected $port; @@ -15,7 +18,7 @@ class Configuration public function __construct(string $host, int $port, ?string $auth = null) { - $this->host = $host; + $this->serverHost = $this->host = $host; $this->port = $port; @@ -27,6 +30,16 @@ public function host(): string return $this->host; } + public function serverHost(): string + { + return $this->serverHost; + } + + public function setServerHost($serverHost) + { + $this->serverHost = $serverHost; + } + public function auth(): ?string { return $this->auth; @@ -40,7 +53,7 @@ public function port(): int public function getUrl(string $subdomain): string { $httpProtocol = $this->port() === 443 ? 'https' : 'http'; - $host = $this->host(); + $host = $this->serverHost(); if ($httpProtocol !== 'https') { $host .= ":{$this->port()}"; diff --git a/composer.json b/composer.json index 053cab0..7e7f06d 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "cboden/ratchet": "^0.4.3", "clue/block-react": "^1.4", "clue/buzz-react": "^2.9", - "clue/reactphp-sqlite": "^1.4", + "clue/reactphp-sqlite": "dev-modular-worker-for-phar-support", "guzzlehttp/guzzle": "^7.2", "guzzlehttp/psr7": "^1.7", "illuminate/log": "^8.0", @@ -66,6 +66,12 @@ "Tests\\": "tests/" } }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/seankndy/reactphp-sqlite" + } + ], "minimum-stability": "dev", "prefer-stable": true, "bin": [