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

CORS requirements can be misread #192

Open
orryverducci opened this issue Nov 15, 2022 · 4 comments
Open

CORS requirements can be misread #192

orryverducci opened this issue Nov 15, 2022 · 4 comments
Assignees

Comments

@orryverducci
Copy link

This is a follow up to a conversation in an issue logged with the NMOS API Testing Tool (AMWA-TV/nmos-testing#722).

Currently the Server Side Implementation Notes state that "all NMOS APIs MUST implement valid CORS HTTP headers in responses to all requests". As currently worded this can be interpereted to mean that all APIs must always send CORS headers, regardless of whether or not the client is making a cross origin request that requires CORS headers.

However the Fetch specification, which specifies CORS, only requires servers to send CORS headers if the client is making a cross origin request and participating in the CORS protocol. This is indicated by the client sending an Origin header, or in the case of a preflight request an Access-Control-Request-Method header.

I expect the intention here was not for NMOS API servers to respond with CORS headers at all times, but rather for servers to respond with the appropriate CORS headers to allow a cross origin request when the client makes a CORS request as per the Fetch specification. As such the NMOS specifications should be reworded to clarify this.

The issue with the current wording is some NMOS client implementations expect server to always send CORS headers. However some servers and development frameworks (e.g. ASP.NET) by default only send CORS headers when they receive an appropriate header (e.g. Origin) in the request from the client, which is valid behaviour per the Fetch specification.

@garethsb
Copy link
Contributor

Thanks for the follow up. I agree with your assessment of the specs.

some NMOS client implementations expect server to always send CORS headers.

Without naming names, are you aware of controllers that expect these headers, not just the testing tool (previous to the fix by AMWA-TV/nmos-testing#724)?

@orryverducci
Copy link
Author

Admittedly the testing tool is the only client I'm aware of that is explicitly checking for CORS headers.

I am aware of a commercially available controller that is developed on top of .NET / ASP.NET and always sends CORS server headers based on their interpretation of the current specification (and likely previous testing tool behaviour). As mentioned previously I know from experience that is not default behaviour for the framework, and so the developers would have had to go though some hoops to override that.

@peterbrightwell
Copy link
Contributor

peterbrightwell commented Jun 23, 2023

Architecture Review Group review: place on backlog

@garethsb
Copy link
Contributor

I will review latest Fetch spec and see what the simplest change to the NMOS specs (Server Side Implementation sections) would be.

@garethsb garethsb self-assigned this Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants