Hi Stef,

Thanks for the response .. that may work for me, but I want to remove some code from cockpit plugin and if is already decoupled it would be much easier

Does cockpit support it? From the documentation it seems too but I can't get it working


Em ter, 4 de fev de 2020 09:47, Stef Walter <swalter@redhat.com> escreveu:
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:


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



> 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 = wss://
> <>
> 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 -- cockpit-devel@lists.fedorahosted.org
> To unsubscribe send an email to cockpit-devel-leave@lists.fedorahosted.org
> 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/cockpit-devel@lists.fedorahosted.org