-
Notifications
You must be signed in to change notification settings - Fork 184
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
proxy: Avoid sorting endpoints for every request #4514
Conversation
} | ||
} | ||
} | ||
|
||
// override default director with root. If any | ||
if ri, ok := rt.directors[pol][config.PrefixRoute][method]["/"]; ok { // try specific method | ||
if ri := rt.directors[pol][config.PrefixRoute][method][0]; ri.endpoint == "/" { // try specific method |
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 am still not too happy with this. I guess I need something better here for the fallback/default routes.
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 thought about my comment about the archiver again, and actually I'm confused here. oC Web always adds the public-token
to the url query (on any public link), so the public token auth provider should be used in the authentication middleware... and fails? Might just be a bug in the auth provider. The route should not be unprotected, as I thought initially. Does that sound reasonable? 🤔
💥 Acceptance test localApiTests-apiArchiver-ocis failed. Further test are cancelled... |
Yes. That's what I also found out while looking at the code. And it's exactly what this commit (6bbdcc2) implements. IIUC the |
Hm, this seems to break the archiver somehow:-( (https://drone.owncloud.com/owncloud/ocis/15224/42/8) |
Ah, makes sense, thanks for explaining ❤️ |
7583d78
to
26cdbf8
Compare
You need to rebase from master and then the |
Allows /archiver to be used the "public-token" auth middleware. The archiver is a bit of a special case, because it can be uses in several ways: using 'normal' authentication (basic, oidc), using signed-urls or using sharetokens. As only the "sharetoken" part is handled by the "PublicShareAuth" middleware, we needed to special-case it a bit.
The endpoints are no longer hashed by path name in the directors map since that made iterating over the endpoints unstable. They are now stored in a slice in the order in which the are defined in the configuration. Closes: owncloud#4497
Kudos, SonarCloud Quality Gate passed! |
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 think the whole proxy code is not ideal but this is good for now. 👍
Description
The endpoints are no longer hashed by path name in the directors map since that made iterating over the endpoints unstable. They are now stored in a slice in the order in which the are defined in the configuration.
This also includes a fix to make the archiver work for public-links (#4461 (review))
Related Issue