Skip to content

Commit

Permalink
[5.x] Fix: Include port in CSP for Live Preview
Browse files Browse the repository at this point in the history
  • Loading branch information
dmxmo committed Feb 25, 2025
1 parent 9139cb0 commit da9507d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Tokens/Handlers/LivePreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function handle(Token $token, $request, Closure $next)
if (Sites::multiEnabled()) {
/** @var Collection */
$siteURLs = Sites::all()
->map(fn (Site $site) => $this->getSchemeAndHost($site))
->map(fn(Site $site) => $this->getSchemeAndHost($site))
->values()
->unique()
->join(' ');
Expand All @@ -39,6 +39,8 @@ private function getSchemeAndHost(Site $site): string
{
$parts = parse_url($site->absoluteUrl());

return $parts['scheme'].'://'.$parts['host'];
$port = isset($parts['port']) ? ':' . $parts['port'] : '';

return $parts['scheme'] . '://' . $parts['host'] . $port;
}
}

0 comments on commit da9507d

Please sign in to comment.