• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

[RESOLVED] Webstream loaded via JS - CORS blocked

Status
Not open for further replies.

Dooley_labs

Donor
is awesome!
Insider
I need to be able to get the webstream through java in order to add a visualizer to my webstream. I've verified everything works webstream-wise and in my javascript, but SinusBot is denying Cross-Origin Requests. How would I go about allowing them so the bot would play?

My current code is available here should anyone need to review it, but please, hands off, don't duplicate it.

https://meozcraft.com/moobeta

The version that currently is in use and works is a render of @Crank's webstream, available at:
https://meozcraft.com/moobot | https://meozcraft.com/nightbot

The only issue I see is a CORS error, stemming from the built-in webserver of SinusBot itself.

OS: Debian 8.5
SinusBot: 0.9.12-58b509d
Webserver: Apache2 2.4.10

EDIT: This is what my research has found so far: http://stackoverflow.com/questions/...utputs-zeroes-due-to-cors-access-restrictions

EDIT #2: Further research shows that starting Google Chrome with the disabled security flag allows my webstream to work as intended... Surely there's something configurable within Sinusbot to allow this without sacrificing my browser's security.
 
Last edited:

slurm

New Member
You could use a reverse proxy adding that header or request a new configuration parameter from the author.
 

Dooley_labs

Donor
is awesome!
Insider
I'm requesting a new config option here, but you're definitely onto something. I already use a reverse proxy to get around port 8443, so I'll see how hard it is to add that header, since it looks like the browser itself is denying me, and not SinusBot.
 

Dooley_labs

Donor
is awesome!
Insider
No luck with reverse proxying any of it. My code from the virtualhost config:
Code:
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods: GET, POST, PUT, DELETE

I need external support, any suggestions?
 

Dooley_labs

Donor
is awesome!
Insider
Issue resolved. In the end, it was a non-traditional reverse proxy, as suggested by @slurm, which resolved my issue.
I may post a small guide with it if @Crank will allow me to upload my version of his bot as my own resource, giving him credit for the original version, of course.
 
Status
Not open for further replies.
Top