-
Notifications
You must be signed in to change notification settings - Fork 187
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 issues when running web on different host #5108
Comments
cc @wkloucek this is what we saw today in our zoom call |
I found a (fairly reasonable) workaround that works in our new development setup, so there's no real urgency to get this fixed from our side. |
Despite the recently closed tickets/PRs linking this issue, it's still not fixed in oCIS latest |
@dschmidt what config did you use and what is exactly the problem? You need to set the |
Okay, thanks for the hint - I'm pretty sure I've looked into it with someone from the oCIS team at some point and we concluded that in fact it was broken. I've now added the following env vars to oCIS in the Web development setup:
Here are the failed requests I can see for now (possibly more after these have been fixed):
Note: oCIS is running on port 9200, our frontend development server is running on port 9201 |
Actually you only should set
(https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods) |
Thanks a lot, @wkloucek - really good catch! With just
|
@dschmidt Can not reproduce on my local. Please describe your environment. |
If you are testing with the current oC Web dev stack, you need to remove the traefik cors middleware from the ocis service to make the issue visible again. |
Looks like some requests don't contain the @janackermann or @JammingBen Could you validate please if the request on the screenshot contains the Steps: |
@2403905 Access-Control-Allow-Origin Access-Control-Expose-Headers See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers Otherwise, only those headers will be provided:
https://developer.mozilla.org/en-US/docs/Glossary/CORS-safelisted_response_header You can check if those CORS entries are set by yourself in the browser's debug tools. I can't give you a general answer on that question, because it depends how OCIS and Web are deployed |
@janackermann https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request |
@2403905 So to clarify: Frontend can't change anything that's CORS related it's 100% server side, PREFLIGHT Requests are done by the browser (not in our hand) and we can't manipulate this. |
@janackermann Is the frontend managing the |
@2403905 as I said before, cors is exclusive handled by server. Cors would be senseless if managed by Frontend |
I found the cause but @janackermann we still need to work together to figure out the root cause of this issue. |
Describe the bug
Serving the web assets from a different host / port than the backend causes CORS issues.
The first failing request after login is an
OPTIONS
request to/ocs/v1.php/cloud/user
, there are probably more issues. 😉In the case of the mentioned
OPTIONS
request the backend requires authentication and returns a401
, whereasOPTIONS
requests should never require authentication.Steps to reproduce
Steps to reproduce the behavior:
web
master (after Fix idp config dev setup web#8016 is merged)docker-compose up -d
ln -s ../dev/docker/ocis.web.config.json config/config.json
pnpm i && pnpm serve
https://host.docker.internal:9100
(you might need to addhost.docker.internal
as localhost alias to your/etc/hosts
file if not already present)Expected behavior
You should be able to login and see your personal space ;-)
Actual behavior
CORS errors
Setup
The dev setup from the
web
repo, seesteps to reproduce
, with an up to date ocis docker image.The text was updated successfully, but these errors were encountered: