TECHZEN Zenoss User Community ARCHIVE  

Cross-Domain JSON post request to the API?

Subject: Cross-Domain JSON post request to the API?
Author: Alberto
Posted: 2014-07-21 09:40

Hi all,

I'm trying to access the API through javascript, but I'm hitting a barrier where I can't post Ajax JSON POST requests to the API, since my website is not hosted on the same domain as the zenoss instance (well, it's on the same domain but not using the same port, thus hitting the same-origin barrier imposed on XMLHttpRequest).

As far as I can see, I have two possible solutions. I can either host my webpage on the same domain and port as zenoss (I would then need to be able to put my website folder on the document root and be able to browse it) or I need to add the header "Access-Control-Allow-Origin" to the responses sent by Zenoss to my requests.

The thing is, I don't know how to do any of those. I think I may be able to add the header when creating the response using the HTTPResponse class from ZPublisher, but I have no idea where Zenoss is actually instantiating this class.

Can anyone please shed a light over this

Thanks.



Subject: Anyone?
Author: Alberto
Posted: 2014-07-24 04:23

Anyone



Subject: Don't hack Zenoss
Author: Jan Garaj
Posted: 2014-07-26 03:47

Don't hack Zenoss ;-). Set header in your webserver (nginx/apache/...) - see http://enable-cors.org/server.html

Devops Monitoring Expert advice: Dockerize/automate/monitor all the things.

DevOps stack: Docker / Kubernetes / Mesos / Zabbix / Zenoss / Grafana / Puppet / Ansible / Vagrant / Terraform / Elasticsearch



Subject: Good point. So which version
Author: Jan Garaj
Posted: 2014-07-31 16:43

Good point. So which version of Zenoss do you use

Devops Monitoring Expert advice: Dockerize/automate/monitor all the things.

DevOps stack: Docker / Kubernetes / Mesos / Zabbix / Zenoss / Grafana / Puppet / Ansible / Vagrant / Terraform / Elasticsearch



Subject: Zenoss uses NGINX.. you can
Author: Jay Stanley
Posted: 2014-08-12 22:44

Zenoss uses NGINX.. you can find the configs in $ZENHOME/etc/ .. the configs have nginx in the name.



< Previous
Zenoss 4.2.5 Dashboard Priority
  Next
zenoss-core-5.0.0b1.virtualbox.ova error
>