feat: redirect users to installer on fresh installations#2438
feat: redirect users to installer on fresh installations#2438apple050620312 wants to merge 6 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughA new middleware checks whether the app is installed, redirects uninstalled requests to the installer route, registers that middleware globally, and excludes it from the installer route itself. ChangesInstallation guard middleware
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/Http/Middleware/RedirectIfNotInstalled.php`:
- Around line 22-30: The RedirectIfNotInstalled middleware is blocking the /up
health check by treating it like a normal unauthenticated route. Update the
allowlist check in the middleware’s request guard so that /up (the health route
registered in bootstrap/app.php) bypasses the installer redirect alongside
installer and livewire paths. Keep the existing JSON/API handling unchanged, and
make sure the redirect only applies to non-allowed, non-API routes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: bc47b51d-858d-4485-ae05-922e4e10c22a
📒 Files selected for processing (2)
app/Http/Middleware/RedirectIfNotInstalled.phpbootstrap/app.php
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@routes/base.php`:
- Line 7: The installer route exemption currently only applies to the main GET
entrypoint, so Livewire update requests are still being caught by
RedirectIfNotInstalled through the web middleware stack. Update the Livewire
update handling so /livewire/update is also excluded during installation, using
the existing route setup in routes/base.php and the RedirectIfNotInstalled
middleware as the place to verify the exemption.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0f80fc7e-eb9c-455a-8446-1d169f4e060e
📒 Files selected for processing (3)
app/Http/Middleware/RedirectIfNotInstalled.phpbootstrap/app.phproutes/base.php
💤 Files with no reviewable changes (1)
- app/Http/Middleware/RedirectIfNotInstalled.php
|
@coderabbitai resume |
✅ Action performedReviews resumed. |
Closes #2413
What does this PR do?
This PR resolves an issue where a fresh installation (e.g. via Docker) throws a generic 500 error when visiting the root URL (
/) or/logindue to the uninitialized database.Instead of showing a generic error, this PR introduces a global
RedirectIfNotInstalledmiddleware that automatically guides the operator to the/installerif the panel has not yet completed its first-run setup (config('app.installed') === false).Implementation Details
App\Http\Middleware\RedirectIfNotInstalledto gracefully intercept incoming requests.route('installer').503 Service Unavailableresponse./installerand/livewire/*routes are explicitly allowed to proceed so the setup process functions correctly.bootstrap/app.php.How to Test
ghcr.io/pelican-dev/panel:latestDocker image) without completing the web installer.https://panel.example.com/orhttps://panel.example.com/login.https://panel.example.com/installerinstead of showing a generic "Something went wrong" modal.