Communicate with the Splunk server for apps outside of Splunk Web

Web apps that run outside of Splunk Web need to use a proxy server or cross-origin resource sharing (CORS) to communicate with the Splunk server due to Same Origin Policy (SOP) browser security policies.

Proxy server

If you are using a proxy server, specify the path to it in the proxyPath key in the SplunkJS Stack configuration.

splunkjs.config({
    proxyPath: "/path_to_proxy_server",
    ...
});

For more, see Load libraries and configure SplunkJS Stack for apps outside of Splunk Web.

CORS

If you are using CORS, you'll need to configure the Splunk server to allow your web site to communicate with it using a CORS connection. To do this, add your web site's address as a trusted HTTP origin to the crossOriginSharingPolicy attribute in the server.conf configuration file.

For example, add this stanza to the $SPLUNK_HOME/etc/system/local/server.conf configuration file, then restart Splunk:

[httpServer]
crossOriginSharingPolicy = your_site_address