Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1751 - Add error thrown if APP_URL does not match current url #1985

Merged
merged 6 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/Actions/Diagnostics/Errors.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Actions\Diagnostics;

use App\Actions\Diagnostics\Pipes\Checks\AdminUserExistsCheck;
use App\Actions\Diagnostics\Pipes\Checks\AppUrlMatchCheck;
use App\Actions\Diagnostics\Pipes\Checks\BasicPermissionCheck;
use App\Actions\Diagnostics\Pipes\Checks\ConfigSanityCheck;
use App\Actions\Diagnostics\Pipes\Checks\DBIntegrityCheck;
Expand Down Expand Up @@ -32,6 +33,7 @@ class Errors
GDSupportCheck::class,
ImageOptCheck::class,
IniSettingsCheck::class,
AppUrlMatchCheck::class,
MigrationCheck::class,
PHPVersionCheck::class,
TimezoneCheck::class,
Expand Down
21 changes: 21 additions & 0 deletions app/Actions/Diagnostics/Pipes/Checks/AppUrlMatchCheck.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace App\Actions\Diagnostics\Pipes\Checks;

use App\Contracts\DiagnosticPipe;

class AppUrlMatchCheck implements DiagnosticPipe
{
/**
* {@inheritDoc}
*/
public function handle(array &$data, \Closure $next): array
{
if (config('app.url') !== request()->httpHost() &&
config('app.url') !== request()->schemeAndHttpHost()) {
$data[] = 'Error: APP_URL does not match the current url. This will break U2F authentication. Please update APP_URL to reflect this change.';
}

return $next($data);
}
}