Skip to content

Commit d67ae26

Browse files
committed
Support subdomain
1 parent 01799fc commit d67ae26

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

UPGRADE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ If you are relying on Quill.js specifics (like css classes), use `'type' => 'qui
5252
Previously `withVideo` was true by default, if you relied on this you have to update these media fields to
5353
`'withVideo' => true`.
5454

55-
#### SVG's are now no longer passing thorough glide
55+
#### SVG's are now no longer passing through glide
5656

5757
These are now rendered directly, you can change this by updating config `twill.glide.original_media_for_extensions` to an empty array `[]`
5858

src/TwillRoutes.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Illuminate\Support\Arr;
99
use Illuminate\Support\Facades\Route;
1010
use Illuminate\Support\Str;
11+
use function request;
1112

1213
class TwillRoutes
1314
{
@@ -405,10 +406,14 @@ public function getAuthRedirectPath(): string
405406

406407
public function isTwillRequest(): bool
407408
{
408-
$adminAppUrl = config('twill.admin_app_url', config('app.url'));
409+
$adminAppUrl = str_replace(['http://', 'https://'], '', config('twill.admin_app_url', config('app.url')));
410+
$requestHost = request()->getHttpHost();
409411

410-
$matchesDomain = !config('twill.admin_app_strict') || Str::endsWith(\request()->getSchemeAndHttpHost(), $adminAppUrl);
411-
$matchesPath = empty(config('twill.admin_app_path')) || \request()->is(config('twill.admin_app_path', '') . '*');
412+
$matchesDomain = config('twill.support_subdomain_admin_routing') ?
413+
Str::startsWith($requestHost, config('twill.admin_app_subdomain', 'admin') . '.') && Str::endsWith($requestHost, '.' . $adminAppUrl)
414+
: !config('twill.admin_app_strict') || $requestHost === $adminAppUrl;
415+
416+
$matchesPath = empty(config('twill.admin_app_path')) || request()->is(config('twill.admin_app_path', '') . '*');
412417

413418
return $matchesDomain && $matchesPath;
414419
}

0 commit comments

Comments
 (0)