lthn.io/app/Website/Docs/Boot.php
Claude 4f72d62146
feat: Octane domain middleware + fix catch-all route conflicts
DomainScope middleware checks Host header per-request — Octane-safe.
Applied to Api homepage (scoped to api.lthn.io). Explorer and Docs
subdomain routes stay disabled — catch-all routes like /{section}/{page?}
match before middleware runs, breaking other routes. These modules
need own containers for proper domain isolation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 11:31:19 +01:00

48 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace Website\Docs;
use Core\Events\DomainResolving;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider;
/**
* docs.lthn.io — Lethean documentation site.
*
* Routes disabled in shared app — catch-all /{section}/{page?} conflicts
* with lthn.io routes even with domain middleware (Laravel matches routes
* before middleware runs). Deploy as own container to enable.
*/
class Boot extends ServiceProvider
{
public static array $domains = [
'/^docs\.lthn\.io$/',
];
public static array $listens = [
DomainResolving::class => 'onDomain',
];
public function register(): void {}
public function boot(): void
{
$this->loadViewsFrom(__DIR__ . '/Views', 'docs');
foreach (static::$listens as $event => $method) {
Event::listen($event, [$this, $method]);
}
}
public function onDomain(DomainResolving $event): void
{
foreach (static::$domains as $pattern) {
if (preg_match($pattern, $event->domain)) {
$event->resolve($this);
return;
}
}
}
}