Fix redirect issue when using custom domains

This commit is contained in:
Marcel Pociot
2022-02-23 12:43:54 +01:00
parent 3aa4847d33
commit 813f742c20
3 changed files with 24 additions and 3 deletions

View File

@@ -120,6 +120,8 @@ class Client
$httpProtocol = $this->configuration->port() === 443 ? 'https' : 'http'; $httpProtocol = $this->configuration->port() === 443 ? 'https' : 'http';
$host = $data->server_host ?? $this->configuration->host(); $host = $data->server_host ?? $this->configuration->host();
$this->configuration->setServerHost($host);
$this->logger->info($data->message); $this->logger->info($data->message);
$this->logger->info("Local-URL:\t\t{$sharedUrl}"); $this->logger->info("Local-URL:\t\t{$sharedUrl}");
$this->logger->info("Dashboard-URL:\t\thttp://127.0.0.1:".config()->get('expose.dashboard_port')); $this->logger->info("Dashboard-URL:\t\thttp://127.0.0.1:".config()->get('expose.dashboard_port'));

View File

@@ -6,6 +6,9 @@ class Configuration
{ {
/** @var string */ /** @var string */
protected $host; protected $host;
/** @var string */
protected $serverHost;
/** @var int */ /** @var int */
protected $port; protected $port;
@@ -15,7 +18,7 @@ class Configuration
public function __construct(string $host, int $port, ?string $auth = null) public function __construct(string $host, int $port, ?string $auth = null)
{ {
$this->host = $host; $this->serverHost = $this->host = $host;
$this->port = $port; $this->port = $port;
@@ -27,6 +30,16 @@ class Configuration
return $this->host; return $this->host;
} }
public function serverHost(): string
{
return $this->serverHost;
}
public function setServerHost($serverHost)
{
$this->serverHost = $serverHost;
}
public function auth(): ?string public function auth(): ?string
{ {
return $this->auth; return $this->auth;
@@ -40,7 +53,7 @@ class Configuration
public function getUrl(string $subdomain): string public function getUrl(string $subdomain): string
{ {
$httpProtocol = $this->port() === 443 ? 'https' : 'http'; $httpProtocol = $this->port() === 443 ? 'https' : 'http';
$host = $this->host(); $host = $this->serverHost();
if ($httpProtocol !== 'https') { if ($httpProtocol !== 'https') {
$host .= ":{$this->port()}"; $host .= ":{$this->port()}";

View File

@@ -24,7 +24,7 @@
"cboden/ratchet": "^0.4.3", "cboden/ratchet": "^0.4.3",
"clue/block-react": "^1.4", "clue/block-react": "^1.4",
"clue/buzz-react": "^2.9", "clue/buzz-react": "^2.9",
"clue/reactphp-sqlite": "^1.4", "clue/reactphp-sqlite": "dev-modular-worker-for-phar-support",
"guzzlehttp/guzzle": "^7.2", "guzzlehttp/guzzle": "^7.2",
"guzzlehttp/psr7": "^1.7", "guzzlehttp/psr7": "^1.7",
"illuminate/log": "^8.0", "illuminate/log": "^8.0",
@@ -66,6 +66,12 @@
"Tests\\": "tests/" "Tests\\": "tests/"
} }
}, },
"repositories": [
{
"type": "vcs",
"url": "https://github.com/seankndy/reactphp-sqlite"
}
],
"minimum-stability": "dev", "minimum-stability": "dev",
"prefer-stable": true, "prefer-stable": true,
"bin": [ "bin": [