Skip to content
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

Allow Access-Control-Allow-Origin header #5451

Open
2 tasks done
dshelters opened this issue Sep 5, 2024 · 0 comments
Open
2 tasks done

Allow Access-Control-Allow-Origin header #5451

dshelters opened this issue Sep 5, 2024 · 0 comments
Labels

Comments

@dshelters
Copy link

dshelters commented Sep 5, 2024

Initial checklist

  • I understand this is a feature request and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Problem

The docs state that the corsOrigins (and by extension, the COMPANION_CLIENT_ORIGINS env var for standalone) "is used for [the] CORS’ Access-Control-Allow-Origin header," but the Access-Control-Allow-Origin is never allowed by the companion server. This should be an allowed header on companion so that the client can set this header when making requests to companion.

Solution

First option is simply to update the docs so that they do not state that this variable / option will be used for this header, because it's not an allowed header at all in Companion. Better if they inform developers that the Access-Control-Allow-Origin header is not an allowed header which can be sent to companion.

Alternatives

Even better, IMO, would be to allow the client to verify the Access-Control-Allow-Origin header. If I'm understanding the Companion code correctly, it seems like it sends requests to itself for different tasks, and on those requests, it uses the headers from the original client request. I understand how this would cause a problem, because now the origin is different. But I think that can pretty easily be remedied.

When COMPANION_CLIENT_ORIGINS is set to a non-true string (or corsOrigins), we could:

  • Include access-control-request-headers in allowedHeaders in when exporting the cors function
  • When creating headers for internal requests based on the initial request, like in uploadMultipart, either delete or update any Access-Control-Allow-Origin or Access-Control-Request-Headers that specify the origin.
  • Remove access-control-request-headers from the blacklist of client headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant