Troubleshooting the Splunk SDK for JavaScript

This topic describes how to troubleshoot problems when coding with the Splunk® SDK for JavaScript. It contains the following sections:

If you still have questions after reading this topic, see the Questions? sidebar on the right side of this page for additional help.

"Cross-domain request is not allowed" error in the browser

The browser limits requests to other domains (the Single Origin Policy). In Splunk Enterprise 6.x, you can enable such requests using the crossOriginSharingPolicy attribute in the server.conf file. In previous versions of Splunk, you need to have some kind of proxy to communicate with Splunk.

Another reason you might be seeing this error is if you loaded your HTML file using the file:// protocol. The browser has heightened security requirements, and so the file has to be loaded through HTTP or HTTPS.

404 errors for "/proxy/<PATH>"

The JavaScript SDK browser examples use a small Node.js web server that is also capable of proxying requests to Splunk. The proxy is accessed when making requests to "/proxy/...". You can use the same pattern on your own web server by having a simple proxy. For instance, in Apache, edit the mod_proxy module.