Req CORS/JSONP Support
#16
Why shouldn't you be able to do a JSON-RPC request with GET? XBMC supports it.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#17
That's funny. I experimented with curl and I seemed to only be able to get it to work using --data-binary It didn't seem to work with the 'request' query string. Maybe I just typed something wrong.
Reply
#18
(2014-01-18, 00:27)jfcarroll Wrote: That's funny. I experimented with curl and I seemed to only be able to get it to work using --data-binary It didn't seem to work with the 'request' query string. Maybe I just typed something wrong.

That is still a GET request, you just send json request as data
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#19
According to the curl man page:

Quote: --data-binary <data>
(HTTP) This posts data exactly as specified with no extra processing whatsoever.

I assumed 'post' meant POST and that this set the payload but maybe it's just bad wording on curl's part.

Anyway. I got it to work using an iframe to make the cross-domain call and setting the src using angularjs. I'd still like to do it right because there's no way for me to see if the result was successful.
Reply
#20
any news on this? CORS support would be nice
Reply
#21
I think it's totally legit request to have xbmc json-rpc to have CORS headers enabled for local network or at least JSONP response.
JavaScript call to xbmc is imposible without server side code (or chrome extension from what i've found).
Well the call is ok, but the response is not readable with JS.

Good thing is that WebSocket connections removes these problems, but its not working on XBMC for Android.
Reply
#22
(2014-04-25, 02:27)cucko Wrote: I think it's totally legit request to have xbmc json-rpc to have CORS headers enabled for local network or at least JSONP response.
JavaScript call to xbmc is imposible without server side code (or chrome extension from what i've found).
Well the call is ok, but the response is not readable with JS.
What? There are quite a few nice webinterfaces in XBMC which completely rely on JavaScript without any server-side code and they work just fine without CORS or JSONP. The response is simple JSON embedded in a HTTP message body and JavaScript is perfectly capable of handling that.

(2014-04-25, 02:27)cucko Wrote: Good thing is that WebSocket connections removes these problems, but its not working on XBMC for Android.
This is the first time I hear about this. You don't happen to have a debug log?
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#23
(2014-04-25, 07:47)Montellese Wrote: What? There are quite a few nice webinterfaces in XBMC which completely rely on JavaScript without any server-side code and they work just fine without CORS or JSONP. The response is simple JSON embedded in a HTTP message body and JavaScript is perfectly capable of handling that.
it's not a problem to access same domain with javascript. the problem is when i try to make a request to json-rpc from different pc with javascript.
one way to bypass this on chrome is to create an extension and make all the requests there. but without CORS header making requests is impossible only with javascript (and without using some kind of proxy page).

(2014-04-25, 07:47)Montellese Wrote: This is the first time I hear about this. You don't happen to have a debug log?
i have installed xbmc on android, then tried to connect from web browser on ws//ip:9090. connection has failed. http 8080 and 80 are working ok.
Reply
#24
(2014-05-03, 22:21)cucko Wrote: it's not a problem to access same domain with javascript. the problem is when i try to make a request to json-rpc from different pc with javascript.
one way to bypass this on chrome is to create an extension and make all the requests there. but without CORS header making requests is impossible only with javascript (and without using some kind of proxy page).
Yes but that is a completely different problem and doesn't warrant a statement like
Quote:JavaScript call to xbmc is imposible without server side code (or chrome extension from what i've found).
Well the call is ok, but the response is not readable with JS.
It works perfectly fine just not for cross-domain requests.

(2014-05-03, 22:21)cucko Wrote:
(2014-04-25, 07:47)Montellese Wrote: This is the first time I hear about this. You don't happen to have a debug log?
i have installed xbmc on android, then tried to connect from web browser on ws//ip:9090. connection has failed. http 8080 and 80 are working ok.
You need to connect to
Code:
ws://<ip>:<port>/jsonrpc
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#25
I'm currently developing a little web app remote control thing & have hit this issue. The websocket protocol gets me most of the way there, but I still need to use plain HTTP if I want images. When the user adds their HTTP port, username & password, I can't verify these details are correct as responses aren't inspectable.
Reply
#26
Any news about that feature? I ran into the same problem. Even if it's true you can always quickly code a proxy that enable it on the machine where Kodi is running, having it build in would be way better.
Reply
#27
JSONP support has been added but full CORS support not yet.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#28
Thanks for the quick answer! Do you know by any chance if there is some doc about JSONP? Couldn't find any...
Reply
#29
Any word on being able to support configuring CORS? I have three Kodi boxes and I was trying to create a web application to play movies at what ever one I want.
Reply

Logout Mark Read Team Forum Stats Members Help
CORS/JSONP Support0