<?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: How do I enable CORS in Splunk Enterprise ? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-enable-CORS-in-Splunk-Enterprise/m-p/403531#M71692</link>
    <description>&lt;P&gt;@Nagarajv&lt;/P&gt;

&lt;P&gt;Have you tried to connect Splunk using SplunkJavascript SDK?&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/javascript-sdk/SP-CAAAEDD"&gt;http://dev.splunk.com/view/javascript-sdk/SP-CAAAEDD&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 29 Sep 2018 16:52:29 GMT</pubDate>
    <dc:creator>kamlesh_vaghela</dc:creator>
    <dc:date>2018-09-29T16:52:29Z</dc:date>
    <item>
      <title>How do I enable CORS in Splunk Enterprise ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-enable-CORS-in-Splunk-Enterprise/m-p/403530#M71691</link>
      <description>&lt;P&gt;I was trying to  build application outside the Splunk web interface using &lt;STRONG&gt;Splunk REST APIs&lt;/STRONG&gt; and &lt;STRONG&gt;Angular 6&lt;/STRONG&gt; I Got**&lt;EM&gt;CORS rejection error&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;REST API ( I used &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; &lt;CODE&gt;&lt;CODE&gt;&lt;A href="https://localhost:8089/services/auth/login" target="test_blank"&gt;https://localhost:8089/services/auth/login&lt;/A&gt;&lt;/CODE&gt;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;result:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5862i16D5E45E71095ADF/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;BR /&gt;
*&lt;EM&gt;angular Code : *&lt;/EM&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  login(data) {
    const body = new URLSearchParams();
    body.set('username', data.username);
    body.set('password', data.password);
    body.set('output_mode', 'json');
    const options = {
      headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')
  };
  console.log(body.toString());

      this.http.post('https://localhost:8089/services/auth/login', body.toString(), options).subscribe(
        (resData) =&amp;gt; {
          console.log(resData);
        },
        (err) =&amp;gt; {
          console.log(err);
        }
      );
    console.log(data);
    }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;but it is working fine with Post man&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Then I tried Changing  &lt;CODE&gt;server.conf&lt;/CODE&gt;&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5863iC2C579C594E6E600/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Sep 2018 15:37:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-enable-CORS-in-Splunk-Enterprise/m-p/403530#M71691</guid>
      <dc:creator>Nagarajv</dc:creator>
      <dc:date>2018-09-29T15:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I enable CORS in Splunk Enterprise ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-enable-CORS-in-Splunk-Enterprise/m-p/403531#M71692</link>
      <description>&lt;P&gt;@Nagarajv&lt;/P&gt;

&lt;P&gt;Have you tried to connect Splunk using SplunkJavascript SDK?&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/javascript-sdk/SP-CAAAEDD"&gt;http://dev.splunk.com/view/javascript-sdk/SP-CAAAEDD&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Sep 2018 16:52:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-enable-CORS-in-Splunk-Enterprise/m-p/403531#M71692</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-09-29T16:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I enable CORS in Splunk Enterprise ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-enable-CORS-in-Splunk-Enterprise/m-p/403532#M71693</link>
      <description>&lt;P&gt;ya @kamlesh_vaghela ,  i tried with splunk-sdk(JS) in node Js and it is working good.&lt;/P&gt;

&lt;P&gt;but now i'm using ReST API's of Splunk  and i'm getting CORSS rejection Error&lt;/P&gt;</description>
      <pubDate>Sat, 29 Sep 2018 17:09:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-enable-CORS-in-Splunk-Enterprise/m-p/403532#M71693</guid>
      <dc:creator>Nagarajv</dc:creator>
      <dc:date>2018-09-29T17:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I enable CORS in Splunk Enterprise ?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-enable-CORS-in-Splunk-Enterprise/m-p/403533#M71694</link>
      <description>&lt;P&gt;If you have admin access to the Splunk server that will receive the requests there is a setting for this in server.conf.&lt;/P&gt;

&lt;P&gt;[httpServer]&lt;BR /&gt;
crossOriginSharingPolicy = &lt;/P&gt;

&lt;P&gt;If the intent here is to build an application that will connect to any Splunk instance with a username and password then it is a matter of following the CORS protocol and using an API container. &lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 23:01:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-enable-CORS-in-Splunk-Enterprise/m-p/403533#M71694</guid>
      <dc:creator>rmjharris</dc:creator>
      <dc:date>2018-10-02T23:01:14Z</dc:date>
    </item>
  </channel>
</rss>

