<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SDK javascript: client side test (error 404) in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/SDK-javascript-client-side-test-error-404/m-p/27536#M1091</link>
    <description>&lt;P&gt;You can try adding the following two lines to your Apache config file:&lt;/P&gt;

&lt;P&gt;SSLProxyEngine On&lt;BR /&gt;
ProxyPass       /proxy/  &lt;A href="https://localhost:4089/"&gt;https://localhost:4089/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;You will need to change localhost:4089 to wherever your splunkd is (the management host and port). Once you do that, any request that goes to /proxy on your server will be routed to your splunkd installation.&lt;/P&gt;</description>
    <pubDate>Fri, 10 Aug 2012 17:54:10 GMT</pubDate>
    <dc:creator>ineeman</dc:creator>
    <dc:date>2012-08-10T17:54:10Z</dc:date>
    <item>
      <title>SDK javascript: client side test (error 404)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/SDK-javascript-client-side-test-error-404/m-p/27533#M1088</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I try to use sdk javascript client side so I've splunk on my host where I add the app JSON2 and I have my project on eclipse where I copy the folder client and jquery.min.js. I want to connect to my local splunk so I have test this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="utf-8"&amp;gt;
    &amp;lt;title&amp;gt;How to start a Splunk session&amp;lt;/title&amp;gt;
    &amp;lt;script type="text/javascript" src="scripts/jquery.min.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script type="text/javascript" src="scripts/client/splunk.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;script type="text/javascript" charset="utf-8"&amp;gt;
    function displayApps() {
        var http = new splunkjs.ProxyHttp("/proxy");

        // Create a Service instance and log in 
        var service = new splunkjs.Service(http, {
            username: "admin",
            password: "admin",
            scheme: "https",
            host: "localhost",
            port: "8089"
        });
        // Print installed apps to the console to verify login
        service.apps().fetch(function(err, apps) {
            if (err) {
                alert("Error listing apps");
                return;
            }

            var myapps = "";
            var appsList = apps.list();
            for(var i = 0; i &amp;lt; appsList.length; i++) {
                myapps += "App " + i + ": " + appsList[i].name + "&amp;lt;br/&amp;gt;"
            } 

            document.getElementById("applist").innerHTML=myapps;
        });

    }
    &amp;lt;/script&amp;gt; 
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;button type="button" onclick="displayApps()"&amp;gt;Log in and list apps&amp;lt;/button&amp;gt;
    &amp;lt;p id="applist"&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I've the alert "Error listing apps" and the error is :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"NetworkError: 404 Introuvable - &lt;A href="http://localhost:8080/proxy/services/json/v2/services/auth/login?&amp;quot;" target="test_blank"&gt;http://localhost:8080/proxy/services/json/v2/services/auth/login?"&lt;/A&gt;;
login?
POST &lt;A href="http://localhost:8080/proxy/services/json/v2/services/auth/login" target="test_blank"&gt;http://localhost:8080/proxy/services/json/v2/services/auth/login&lt;/A&gt;?  
404 Introuvable
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And it's say that it's in jquery.min.js that there is the error and I do'nt know why is localhost:8080 and not 8089?????&lt;/P&gt;

&lt;P&gt;Thx by advance if you know where is come from the error.&lt;/P&gt;

&lt;P&gt;Laura,&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2012 12:17:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/SDK-javascript-client-side-test-error-404/m-p/27533#M1088</guid>
      <dc:creator>LauraBre</dc:creator>
      <dc:date>2012-08-07T12:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: SDK javascript: client side test (error 404)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/SDK-javascript-client-side-test-error-404/m-p/27534#M1089</link>
      <description>&lt;P&gt;The problem you're having is due to the browser's Single Origin Policy (&lt;A href="http://en.wikipedia.org/wiki/Same_origin_policy"&gt;http://en.wikipedia.org/wiki/Same_origin_policy&lt;/A&gt;). The specific issue is that your page is going to be running of yourawesomedomain.com, but Splunk will be running on some separate domain (e.g. yourawesomedomain.com:8089), and the browser does not allow communication to happen between those two.&lt;/P&gt;

&lt;P&gt;The solution is to use a server-side proxy to relay the messages. For example, when you run the examples in the SDK, we start up a small webserver that proxies any request to the the "/proxy" endpoint to Splunk. You can similarly have a small proxy in your webserver that does the same.&lt;/P&gt;

&lt;P&gt;If you can say a bit more about your environment (what programming language you're using server side, what webserver, etc), I can give a bit more specific advice and help.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2012 19:07:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/SDK-javascript-client-side-test-error-404/m-p/27534#M1089</guid>
      <dc:creator>ineeman</dc:creator>
      <dc:date>2012-08-07T19:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: SDK javascript: client side test (error 404)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/SDK-javascript-client-side-test-error-404/m-p/27535#M1090</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Thanks very much for your answer. So, if I understand, I have to add a proxy in my apache (I work with a tomcat apache) and eclipse. I program in java. So I create a proxy of my choice. Then what have I to change in my dynamic web java project? And next I just to add the proxy in my browser?&lt;/P&gt;

&lt;P&gt;Thx by advance,&lt;/P&gt;

&lt;P&gt;Laura&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2012 15:46:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/SDK-javascript-client-side-test-error-404/m-p/27535#M1090</guid>
      <dc:creator>LauraBre</dc:creator>
      <dc:date>2012-08-08T15:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: SDK javascript: client side test (error 404)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/SDK-javascript-client-side-test-error-404/m-p/27536#M1091</link>
      <description>&lt;P&gt;You can try adding the following two lines to your Apache config file:&lt;/P&gt;

&lt;P&gt;SSLProxyEngine On&lt;BR /&gt;
ProxyPass       /proxy/  &lt;A href="https://localhost:4089/"&gt;https://localhost:4089/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;You will need to change localhost:4089 to wherever your splunkd is (the management host and port). Once you do that, any request that goes to /proxy on your server will be routed to your splunkd installation.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Aug 2012 17:54:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/SDK-javascript-client-side-test-error-404/m-p/27536#M1091</guid>
      <dc:creator>ineeman</dc:creator>
      <dc:date>2012-08-10T17:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: SDK javascript: client side test (error 404)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/SDK-javascript-client-side-test-error-404/m-p/27537#M1092</link>
      <description>&lt;P&gt;Thx, I did it. I insert my index.html in htdocs of my apache and I add SSLProxyEngine On ProxyPass /proxy/ &lt;A href="https://localhost:8089/"&gt;https://localhost:8089/&lt;/A&gt; in the Apache config file and decommented all modules about proxy. So it works cery well when I doen't use tomcat but when I use tomcat and Apache, there is the error 404 so I don't result the problem with tomcat but I can connect to my spolunk so it's a good thing. Now I want to use this in a dynamic web project where I use tomcat so I search I can I do it? Do you have an idea?&lt;/P&gt;

&lt;P&gt;Thx by advance,&lt;/P&gt;

&lt;P&gt;Laura&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2012 15:29:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/SDK-javascript-client-side-test-error-404/m-p/27537#M1092</guid>
      <dc:creator>LauraBre</dc:creator>
      <dc:date>2012-08-13T15:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: SDK javascript: client side test (error 404)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/SDK-javascript-client-side-test-error-404/m-p/27538#M1093</link>
      <description>&lt;P&gt;I'm running into the same problem when I run the sample from Visual Studio. Do you have any idea where shall I add similar settings when it comes to IIS?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 05:15:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/SDK-javascript-client-side-test-error-404/m-p/27538#M1093</guid>
      <dc:creator>azhicodan</dc:creator>
      <dc:date>2016-04-18T05:15:51Z</dc:date>
    </item>
  </channel>
</rss>

