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

Fix missing CORS headers on RPC response. #2029

Merged
merged 2 commits into from Jan 26, 2022

Conversation

solonovamax
Copy link
Contributor

@solonovamax solonovamax commented Nov 20, 2021

Fixes #2028.

Add CORS headers to RPC response.
This fixes a CORS error on chrome.

See #2028 for more information.

@solonovamax solonovamax changed the title Fixes #2028. Adds CORS headers to RPC response. Fix missing CORS headers on RPC response. Nov 20, 2021
@kingosticks kingosticks added the A-http Area: HTTP frontend label Jan 13, 2022
@kingosticks kingosticks added this to the Next bug fix release milestone Jan 13, 2022
@kingosticks kingosticks self-assigned this Jan 25, 2022
@djmattyg007
Copy link
Contributor

What's preventing the CI pipeline from running for this PR?

@kingosticks
Copy link
Member

No idea - too old? But I have changes for this anyway so it'll run when I push later.

Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
@kingosticks kingosticks force-pushed the fix/fix-rpc-headers branch 2 times, most recently from 8a867f1 to b997247 Compare January 26, 2022 00:47
@kingosticks
Copy link
Member

Why is codecov so useless? I am mostly ignoring it at this point

Added basic cors tests for JsonRpcHandler and WebSocketHandlerTest.
Moved CSRF testing from server into request handler tests.

Better comments on how this all works.

Fixed allowed_origins test bug which defined a list instead of a set.

Fixed options response handler should not return Boolean.
@djmattyg007
Copy link
Contributor

I was kind of hoping we could get this issue resolved before doing further work on the CORS code:

#1966

The first step of my plan towards improving that situation was this PR, which has been waiting for review for a while now:

#2010

It would be great to get that PR moving, as there are many other follow-up changes, some of which I've already made and some of which others have made. For example, this PR also adds a Float config type, but I believe mine is superior. By merging #2010 I can then ask the developer to update their PR accordingly:

#2025

@kingosticks
Copy link
Member

I'm just working through my long list of little things that personally bugged me. There are more CORS-related issues on the tracker, I'll visit yours next.

@kingosticks kingosticks merged commit b4b2981 into mopidy:develop Jan 26, 2022
@kingosticks
Copy link
Member

Oh I actually didn't mean to squash that one. Oops

@kingosticks
Copy link
Member

And thanks @solonovamax for highlighting the issue and providing the original fix. I tweaked it a bit and added some comments explaining how the POST handler is designed to work w.r.t CORS because it wasn't totally obvious to me (after so long) and I wrote the thing!

@solonovamax
Copy link
Contributor Author

Perfect!
I wrote this fix because I had a little widget I made for OBS that connected to the mopidy server. But, since the OBS browser source used a chromium base which (for some reason) had no way to disable the CORS checking, I kept running into these errors
Great to see it merged!

@jodal jodal modified the milestones: Next bug fix release, v3.3.0 Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-http Area: HTTP frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing CORS response headers for RPC requests.
4 participants