Fix FLEXIAPI-348 Add a fallback 404 page for URLs that are pointing to no configured Spaces

This commit is contained in:
Timothée Jaussoin 2025-07-03 15:42:15 +02:00
parent 80f32a9887
commit aa2051d281
4 changed files with 32 additions and 4 deletions

View file

@ -17,7 +17,7 @@ class SpaceCheck
$space = space();
if ($space) {
if ($space != null) {
if (!str_ends_with($space->host, config('app.root_host'))) {
return abort(503, 'The APP_ROOT_HOST configured does not match with the current root domain');
}

View file

@ -1,4 +1,4 @@
@extends('layouts.main')
@extends(space() != null ? 'layouts.main' : 'layouts.main_minimal')
@section('content')

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>@yield('code') - @yield('title')</title>
<link rel="stylesheet" type="text/css" href="{{ asset('css/style.css') }}">
<script src="{{ asset('scripts/utils.js') }}"></script>
<script src="{{ asset('scripts/chart.js') }}"></script>
<script src="{{ asset('scripts/chartjs-plugin-datalabels@2.0.0') }}"></script>
</head>
<body class="@if (isset($welcome) && $welcome) welcome @endif">
<content>
<section>
@yield('content')
</section>
</content>
</body>
</html>

View file

@ -48,8 +48,10 @@ use App\Http\Controllers\Admin\SpaceController;
use App\Http\Controllers\Admin\StatisticsController;
use Illuminate\Support\Facades\Route;
Route::redirect('/', 'login')->name('account.home');
Route::get('about', 'AboutController@about')->name('about');
Route::middleware(['space.check'])->group(function () {
Route::redirect('/', 'login')->name('account.home');
Route::get('about', 'AboutController@about')->name('about');
});
Route::middleware(['web_panel_enabled', 'space.check'])->group(function () {
Route::get('wizard/{provisioning_token}', 'Account\ProvisioningController@wizard')->name('provisioning.wizard');