Skip to content

Commit

Permalink
Fix redirect issue when using custom domains
Browse files Browse the repository at this point in the history
  • Loading branch information
mpociot committed Feb 23, 2022
1 parent 3aa4847 commit 813f742
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 2 additions & 0 deletions app/Client/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
17 changes: 15 additions & 2 deletions app/Client/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ class Configuration
{
/** @var string */
protected $host;

/** @var string */
protected $serverHost;

/** @var int */
protected $port;
Expand All @@ -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;

Expand All @@ -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;
Expand All @@ -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()}";
Expand Down
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -66,6 +66,12 @@
"Tests\\": "tests/"
}
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/seankndy/reactphp-sqlite"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"bin": [
Expand Down

0 comments on commit 813f742

Please sign in to comment.