fix: reorder configureMiddleware before Boot so provider routes survive engine rebuild (#975)#1508
Merged
Merged
Conversation
…ve engine rebuild (#975) In Build(), configureMiddleware was called after Boot(), which means routes registered by service providers during Boot() were silently dropped when SetGlobalMiddleware rebuilt the route engine. Moving configureMiddleware between Register() and Boot() ensures the engine is set up with global middleware before providers register their routes. Fixes goravel/goravel#975
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1508 +/- ##
=======================================
Coverage 69.63% 69.63%
=======================================
Files 384 384
Lines 30183 30183
=======================================
Hits 21017 21017
Misses 8174 8174
Partials 992 992 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
hwbrzzl
pushed a commit
to goravel/example
that referenced
this pull request
Jun 27, 2026
…dleware (#132) Add a RouteProvider that registers GET /provider-route in its Boot() method and a test asserting it returns 200. This validates the fix from goravel/framework#1508 where configureMiddleware was moved between Register() and Boot() to prevent route loss. Co-authored-by: opencode <bot@opencode.local>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes goravel/goravel#975
Routes registered inside a
ServiceProvider.Boot()(e.g.app.MakeRoute().Get(...)) were silently discarded when the application registered any global middleware viaWithMiddleware()inbootstrap/app.go. The routes returned 404 at runtime with no error.Root Cause
In
Build(),configureMiddleware()was called afterBoot(). WhenWithMiddlewareis used,SetGlobalMiddlewarerebuilds the route engine (gin.New()/ equivalent). Routes registered by providers duringBoot()were on the old engine and lost.Fix
Reorder
configureMiddleware()to run betweenRegister()andBoot()instead of afterBoot():Register()configureMiddleware()(moved here)Boot()WithRoutingalso register on the same engine →configureRoutes()This is a one-line move in
foundation/application.go.