-
-
Notifications
You must be signed in to change notification settings - Fork 931
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
fix: Add middleware earlier #1775 #1776
Conversation
cmd/daemon/serve.go
Outdated
n.Use(reqlog.NewMiddlewareFromLogger(l, "public#"+c.SelfPublicURL(nil).String())) | ||
n.Use(sqa(ctx, cmd, r)) | ||
n.Use(r.PrometheusManager()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this after the for loop below
cmd/daemon/serve.go
Outdated
n.Use(reqlog.NewMiddlewareFromLogger(l, "admin#"+c.SelfPublicURL(nil).String())) | ||
n.Use(sqa(ctx, cmd, r)) | ||
n.Use(r.PrometheusManager()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this after the for loop below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I don't think that this is really solving the issue you described. The only thing this does is that the negroni middleware is executed before cleanpath and the csrf middleware!
Yeah this also looked a bit weird to me. This shouldn't make much difference, but it does, since the CSRFHandler is based on the router |
Oh I see, that makes sense! :) |
for _, mw := range modifiers.mwf { | ||
n.UseFunc(mw) | ||
} | ||
n.Use(r.PrometheusManager()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant to say to move all n.Use after the modifiers :) The modifiers are used only for testing, and it is important for them to execute before all other middleware. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad :) Done
Codecov Report
@@ Coverage Diff @@
## master #1776 +/- ##
==========================================
+ Coverage 74.10% 74.13% +0.02%
==========================================
Files 260 260
Lines 12715 12733 +18
==========================================
+ Hits 9423 9439 +16
- Misses 2667 2668 +1
- Partials 625 626 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thank you! 🎉 Your contribution makes Ory better :)
Related issue(s)
#1775
Checklist
contributing code guidelines.
vulnerability. If this pull request addresses a security. vulnerability, I
confirm that I got green light (please contact
security@ory.sh) from the maintainers to push
the changes.
works.
Further Comments
No docs and tests, itonly changes the order of middlewares