<?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: Cannot get splunk web to send CORS headers in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Cannot-get-splunk-web-to-send-CORS-headers/m-p/693486#M11599</link>
    <description>&lt;P&gt;To answer my own question&lt;/P&gt;&lt;P&gt;This was a browser issue.&lt;/P&gt;&lt;P&gt;Both the splunk REST API and Splunk Web must use https for the REST call to succeed. In my case, this means &lt;A href="https://localhost:8000" target="_blank"&gt;https://localhost:8000&lt;/A&gt; for splunk web and &lt;A href="https://localhost:8090" target="_blank"&gt;https://localhost:8090&lt;/A&gt; for the API&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jul 2024 13:06:51 GMT</pubDate>
    <dc:creator>zapping575</dc:creator>
    <dc:date>2024-07-16T13:06:51Z</dc:date>
    <item>
      <title>Cannot get splunk web to send CORS headers</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Cannot-get-splunk-web-to-send-CORS-headers/m-p/693184#M11591</link>
      <description>&lt;P&gt;I have been experimenting with splunk-ui and created an app to make calls from splunk web to the splunk REST API.&lt;/P&gt;&lt;P&gt;However, I keep getting errors like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;The same origin policy prohibits access to external resource at https://localhost:8090/servicesNS/nobody/path_redacted_but_is_valid?output_mode=json. (Reason: CORS-Header 'Access-Control-Allow-Origin' is missing)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;This is how the call looks like&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;const url = `https://localhost:8090/servicesNS/nobody/${eventType.acl.app}/saved/eventtypes/${eventType.title}?output_mode=json`

const response = await fetch(url, {
        credentials: "include",
        method: "POST",
        redirect: "follow",
        body: JSON.stringify({'search': eventType.content.search})
    });
    return response.json();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;This is my server.conf&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[sslConfig]
sslRootCAPath = /opt/splunk/etc/auth/mycerts/cert.pem

[httpServer]
crossOriginSharingPolicy = https://localhost:8090
crossOriginSharingHeaders = *&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can access &lt;A href="https://localhost:8090/servicesNS" target="_blank" rel="noopener"&gt;https://localhost:8090/servicesNS&lt;/A&gt;/*&amp;nbsp; "by it self" in my browser.&lt;/P&gt;&lt;P&gt;I am using Firefox 128 and splunk 9.0.5&lt;/P&gt;&lt;P&gt;I can set crossOriginSharingPolicy to "*" (without quotes), but that will cause the browser to reject any requests that require authentication, so this is no solution&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2024 12:08:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Cannot-get-splunk-web-to-send-CORS-headers/m-p/693184#M11591</guid>
      <dc:creator>zapping575</dc:creator>
      <dc:date>2024-07-12T12:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get splunk web to send CORS headers</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Cannot-get-splunk-web-to-send-CORS-headers/m-p/693486#M11599</link>
      <description>&lt;P&gt;To answer my own question&lt;/P&gt;&lt;P&gt;This was a browser issue.&lt;/P&gt;&lt;P&gt;Both the splunk REST API and Splunk Web must use https for the REST call to succeed. In my case, this means &lt;A href="https://localhost:8000" target="_blank"&gt;https://localhost:8000&lt;/A&gt; for splunk web and &lt;A href="https://localhost:8090" target="_blank"&gt;https://localhost:8090&lt;/A&gt; for the API&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2024 13:06:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Cannot-get-splunk-web-to-send-CORS-headers/m-p/693486#M11599</guid>
      <dc:creator>zapping575</dc:creator>
      <dc:date>2024-07-16T13:06:51Z</dc:date>
    </item>
  </channel>
</rss>

