twill icon indicating copy to clipboard operation
twill copied to clipboard

Front displaying Twill's error pages

Open antonioribeiro opened this issue 1 year ago • 5 comments

Description

It seems that the 404 pages on the routes that are not inside Twill went from this on 3.3.1:

Screenshot 2024-11-12 at 15 43 07

to this, on Twill 3.4.1

Screenshot 2024-11-12 at 15 43 47

The first one is the correct behaviour since the page is not under Twill, it's on frontend.

Steps to reproduce

  • Open a missing URL, being on Twill 3.4.1
  • You will see the Twill (yellow) one
  • To fix it
  • Execute composer require area17/twill:"3.3.1", to move to Twill 3.3.1
  • Refresh the page, and you will see the Laravel one

antonioribeiro avatar Nov 12 '24 14:11 antonioribeiro

Something isn't clear for me in your report @antonioribeiro.

The yellow error pages are from Twill and that's what we want when there is an error inside Twill, not the frontend. Did you get it on the frontend? That was my concern when reviewing that PR but I thought it was covered.

ifox avatar Nov 19 '24 11:11 ifox

Sorry @ifox , what I wrote was really unclear :(, as I just re-read it.

I just edited the description, tell me if it's better now.

antonioribeiro avatar Nov 19 '24 13:11 antonioribeiro

I did review this and actually made a fix for it here https://github.com/area17/twill/commit/042c87e190760e140a746d0ee005c99408078c3c. Could you check what I may have overlooked?

ifox avatar Nov 19 '24 13:11 ifox

@ifox , the problem happens here:

$matchesDomain = config('twill.support_subdomain_admin_routing') ?
        Str::startsWith($requestHost, config('twill.admin_app_subdomain', 'admin') . '.') && Str::endsWith($requestHost, '.' . $adminAppUrl)
        : !config('twill.admin_app_strict') || $requestHost === $adminAppUrl;

As my admin_app_strict is false, which is the default, my front domain (area17.test) is matching Twill's (admin.area17.test), because the only condition needed for it to "match" (it's an OR) is !config('twill.admin_app_strict').

So, it works fine if I set

ADMIN_APP_STRICT=true

Maybe this config should be true by default?

antonioribeiro avatar Nov 19 '24 15:11 antonioribeiro

Here's the only URLs config I'm using for this site:

APP_DOMAIN=area17.test
APP_URL=https://${APP_DOMAIN}
ADMIN_APP_URL=https://admin.${APP_DOMAIN}
#ADMIN_APP_STRICT=true

antonioribeiro avatar Nov 19 '24 15:11 antonioribeiro