Skip to content

Commit

Permalink
fix: disable cloudflare tunnel on "localhost"
Browse files Browse the repository at this point in the history
  • Loading branch information
andrasbacsai committed Nov 8, 2024
1 parent 2f63c77 commit 373e715
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions app/Livewire/Server/CloudflareTunnels.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public function mount(string $server_uuid)
{
try {
$this->server = Server::ownedByCurrentTeam()->whereUuid($server_uuid)->firstOrFail();
if ($this->server->isLocalhost()) {
return redirect()->route('server.show', ['server_uuid' => $server_uuid]);
}
$this->isCloudflareTunnelsEnabled = $this->server->settings->is_cloudflare_tunnel;
} catch (\Throwable $e) {
return handleError($e, $this);
Expand Down
8 changes: 5 additions & 3 deletions resources/views/components/server/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
href="{{ route('server.private-key', ['server_uuid' => $server->uuid]) }}">Private Key
</a>
@if ($server->isFunctional())
<a class="menu-item {{ $activeMenu === 'cloudflare-tunnels' ? 'menu-item-active' : '' }}"
href="{{ route('server.cloudflare-tunnels', ['server_uuid' => $server->uuid]) }}">Cloudflare
Tunnels</a>
@if (!$server->isLocalhost())
<a class="menu-item {{ $activeMenu === 'cloudflare-tunnels' ? 'menu-item-active' : '' }}"
href="{{ route('server.cloudflare-tunnels', ['server_uuid' => $server->uuid]) }}">Cloudflare
Tunnels</a>
@endif
<a class="menu-item {{ $activeMenu === 'destinations' ? 'menu-item-active' : '' }}"
href="{{ route('server.destinations', ['server_uuid' => $server->uuid]) }}">Destinations
</a>
Expand Down
3 changes: 1 addition & 2 deletions resources/views/livewire/server/cloudflare-tunnels.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
<x-helper class="inline-flex"
helper="If you are using Cloudflare Tunnels, enable this. It will proxy all SSH requests to your server through Cloudflare.<br> You then can close your server's SSH port in the firewall of your hosting provider.<br><span class='dark:text-warning'>If you choose manual configuration, Coolify does not install or set up Cloudflare (cloudflared) on your server.</span>" />
</div>
<div>Secure your servers with Cloudflare Tunnels</div>

<div>Secure your servers with Cloudflare Tunnels.</div>
</div>
<div class="flex flex-col gap-2 pt-6">
@if ($isCloudflareTunnelsEnabled)
Expand Down

0 comments on commit 373e715

Please sign in to comment.