On 22.01.20 04:44, Daniel. wrote:
> Hi everybody,
> I have some code that runs as a cockpit plugin. I have a lot of calls to
> cockpit.spawn, which I want to replace by fetch calls. The problem is
> that the software running API is running on port 443, not 9090, so I get
> a big and red error message about CORS not enabled,

Perhaps you could use cockpit.http() to avoid CORS problems:

https://cockpit-project.org/guide/latest/cockpit-http.html

This means the HTTP calls go through the server Cockpit is running on,
than directly from the browser. That should avoid CORS problems.

Cheers,

Stef

> 
> I can check that response has Acces-Control-Allow-Origin set to
> mymachine:9090, in dev tools
> 
> I did some googling and found that I would enable CORS by editing
> cockpit.conf and placing a `Origin = https://mymachine:9090
> wss://mymachine:9090 https://mymachine` I tried that without success. I
> may be wrong here
> 
> I'm running a Centos7 machine with cockpit 195, here is the content of
> my /etc/cockpit/cockpit.conf
> 
> [WebService]
> Origin = https://192.168.123.2:9090 wss://192.168.123.2:9090
> <http://192.168.123.2:9090> http://192.168.123.2 https://192.168.123.2
> 
> Any ideas?
> 
> Best regards
> -- 
> “If you're going to try, go all the way. Otherwise, don't even start. ..."
>   Charles Bukowski
> 
> _______________________________________________
> cockpit-devel mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> Fedora Code of Conduct: 
> https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives: 
> https://lists.fedorahosted.org/archives/list/[email protected]
> 
_______________________________________________
cockpit-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/[email protected]

Reply via email to