<?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: Setting content-type for static content in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Setting-content-type-for-static-content/m-p/97532#M1386</link>
    <description>&lt;P&gt;After beating my head against this for quite a while, the following seems to work if you have at least one custom module being loaded. In the module's python code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import mimetypes
if not mimetypes.inited:
    mimetypes.init()
mimetypes.add_type('image/svg+xml', '.svg', True)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The upshot is that SplunkWeb is calling &lt;CODE&gt;cherrypy.lib.static.serve_file()&lt;/CODE&gt;, which according to &lt;A href="http://cherrypy.org/wiki/StaticContent"&gt;this page&lt;/A&gt; relies in turn on the python &lt;CODE&gt;mimetypes&lt;/CODE&gt; module.&lt;/P&gt;

&lt;P&gt;This still isn't an ideal solution, since it requires mucking about with module python code. Anyone have a more generic approach?&lt;/P&gt;</description>
    <pubDate>Mon, 09 May 2011 18:43:43 GMT</pubDate>
    <dc:creator>southeringtonp</dc:creator>
    <dc:date>2011-05-09T18:43:43Z</dc:date>
    <item>
      <title>Setting content-type for static content</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Setting-content-type-for-static-content/m-p/97531#M1385</link>
      <description>&lt;P&gt;I'm trying to serve up an SVG image from within an app.&lt;/P&gt;

&lt;P&gt;The SVG file is in &lt;CODE&gt;appserver/static&lt;/CODE&gt; and has a &lt;CODE&gt;.svg&lt;/CODE&gt; file extension. I'm able to retrieve the file just fine. However, the browser either fails to render the content or renders it as plain text, presumably because SplunkWeb is giving it a Content-Type of text/plain.&lt;/P&gt;

&lt;P&gt;Does anyone know how to override the default behaviour and tell SplunkWeb (or CherryPy?) to set the correct Content-Type of &lt;CODE&gt;image/svg+xml&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2011 01:33:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Setting-content-type-for-static-content/m-p/97531#M1385</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2011-05-09T01:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Setting content-type for static content</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Setting-content-type-for-static-content/m-p/97532#M1386</link>
      <description>&lt;P&gt;After beating my head against this for quite a while, the following seems to work if you have at least one custom module being loaded. In the module's python code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import mimetypes
if not mimetypes.inited:
    mimetypes.init()
mimetypes.add_type('image/svg+xml', '.svg', True)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The upshot is that SplunkWeb is calling &lt;CODE&gt;cherrypy.lib.static.serve_file()&lt;/CODE&gt;, which according to &lt;A href="http://cherrypy.org/wiki/StaticContent"&gt;this page&lt;/A&gt; relies in turn on the python &lt;CODE&gt;mimetypes&lt;/CODE&gt; module.&lt;/P&gt;

&lt;P&gt;This still isn't an ideal solution, since it requires mucking about with module python code. Anyone have a more generic approach?&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2011 18:43:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Setting-content-type-for-static-content/m-p/97532#M1386</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2011-05-09T18:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: Setting content-type for static content</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Setting-content-type-for-static-content/m-p/97533#M1387</link>
      <description>&lt;P&gt;Late response, but updating answer in case anyone hits this......&lt;/P&gt;

&lt;P&gt;If you don't mind passing your SVG via SPL and using a custom visualisation app then &lt;A href="https://splunkbase.splunk.com/app/3815/"&gt;Scalable Vector Graphics - Custom Visualization&lt;/A&gt; might be another option for you (instead of updating content type for svg)&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 15:57:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Setting-content-type-for-static-content/m-p/97533#M1387</guid>
      <dc:creator>msivill_splunk</dc:creator>
      <dc:date>2018-10-22T15:57:45Z</dc:date>
    </item>
  </channel>
</rss>

