-
Notifications
You must be signed in to change notification settings - Fork 197
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
CORS on /data does not work #8380
Comments
Which version of tusd are you using? In late 2023 cors handling was added to tusd ... see tus/tusd#987 & tus/tusd#997 Let me know if you need a helping hand .... |
As said, it's oCIS 5.0.0-rc.3 and I don't know if it has incorporated those changes. |
tusd is integrated via reva
|
assigning @butonic |
reva part got merged. reva bump in ocis that also contains the necessary configuration is in #8412 |
#8412 took a while to turn green, but is now merged. |
There is a passing test. See linked PR. Are you sure that rc.5 should already work? |
rc.5 should work. Did you configure it? The new defaults are not targeting ocis 5.0.0 #8514 |
@butonic Can you help? You did the reva fix. Was there something missing on the ocis side? |
Sure, Actually the OPTIONS call responds correctly for
I didn't see a obvious link / result fore the passing test. I just saw the whole REVA testsuite passing. Does the test suite cover OPTIONS calls for different request methods? |
I see this test scenario with OPTIONS request: ocis/tests/acceptance/features/apiCors/cors.feature Lines 54 to 72 in b72e5ce
|
Actually there was another change touching the same code path: cs3org/reva#4527 |
But that one is about OCS API and not the reva data gateway 🤔 |
I am only aware of the public API level. if the /data is an internal service level thing then I have no idea 😅 |
That's a public API 😉 It's part of the TUS upload flow |
Ahh, thanks. then I don't see the test coverage related to that (at least not for OPTIONS to /data with different methods) |
do you think adding these to the above test scenario will cover your cases? | 2 | /data | HEAD |
| 2 | /data | PATCH | |
From what I saw in the code of cs3org/reva#4507, the OPTIONS call checks authentication. That means the tests needs to initalize a upload first. I don't know how it's handled after the changes in cs3org/reva#4527. But generally I'd really love to have tests for it (if there are none yet) 🤗 |
Yeah, looks like there's no coverage for it. I will add to the suite 😃 Also, I confirmed these results
|
Probably there are more methods allowed on the /data endpoint. At least POST comes to my mind. But that should be checked with somebody into TUS / the data gateway / provider |
@wkloucek Could you check if this scenario helps? ocis/tests/acceptance/features/apiCors/cors.feature Lines 138 to 160 in b7b5d45
|
@butonic will take over from here |
@saw-jan Regarding the status code I found this comment in the tusd implementation when handling preflight requests: // Although the 204 No Content status code is a better fit in this case,
// since we do not have a response body included, we cannot use it here
// as some browsers only accept 200 OK as successful response to a
// preflight request. If we send them the 204 No Content the response
// will be ignored or interpreted as a rejection.
// For example, the Presto engine, which is used in older versions of
// Opera, Opera Mobile and Opera Mini, handles CORS this way.
handler.sendResp(w, r, http.StatusOK) Ok ... now why did we not run into that? Turns out that we are also checking the CORS headers in the frontend. And fixed by #8651 can also be fixed by setting |
That being said, we should omit checking the CORS headers for the /data endpoint in the frontend service. The datagateway should just forward the preflight requests. |
@wkloucek can we set the patch method for the frontend service as a workaround? |
@micbar @butonic please give owncloud/ocis-charts#504 a review |
Describe the bug
Set
OCIS_CORS_ALLOW_ORIGINS="https:/foobar.com"
whenOCIS_URL=https://something.else
Steps to reproduce
Expected behavior
The upload works
Actual behavior
The upload fails because the OPTIONS request on /data doesn#t return thre right CORS header.
Responses on other routs contain this header, while /data doesn't:
Access-Control-Allow-Origin: https:/foobar.com
Setup
oCIS 5.0.0-rc.3 deployed with the oCIS Chart from next (owncloud/ocis-charts@ebbd8c0)
The text was updated successfully, but these errors were encountered: