title: IPFS X-Ipfs-Path on static images referenced on a dynamic non-IPFS https page forces localhost gateway to load over https
body: <p>I'm trying to utilize IPFS to load static content, such as images and javascript libraries, on a dynamic site loaded on the http protocol.</p>
  <p>For example <a href="https://www.example.com/" rel="nofollow noreferrer">https://www.example.com/</a> is a normal web 2.0 page, with an image reference here <a href="https://www.example.com/images/myimage.jpg" rel="nofollow noreferrer">https://www.example.com/images/myimage.jpg</a></p>
  <p>When the request is made on myimage.jpg, the following header is served</p>
  <pre><code>x-ipfs-path: /ipfs/QmXXXXXXXXXXXXXXXXX/images/myimage.jpg 
  </code></pre>
  <p>Which then gets translated by the IPFS Companion browser plugin as:</p>
  <pre><code>https://127.0.0.1:8081/ipfs/QmXXXXXXXXXXXXXXXXX/images/myimage.jpg
  </code></pre>
  <p>The problem being, is that it has directed to an SSL page on the local IP, which won't load due to a protocol error. (changing the above from https to http works)</p>
  <p>Now, if I were to request <a href="https://www.example.com/images/myimage.jpg" rel="nofollow noreferrer">https://www.example.com/images/myimage.jpg</a> directly from the address bar, it loads the following:</p>
  <pre><code>http://localhost:8081/ipfs/QmYcJvDhjQJrMRFLsuWAJRDJigP38fiz2GiHoFrUQ53eNi/images/myimage.jpg
  </code></pre>
  <p>And then a 301 to:</p>
  <pre><code>http://(some other hash).ipfs.localhost:8081/images/myimage.jpg
  </code></pre>
  <p>Resulting in the image loading successfully.</p>
  <p>I'm assuming because the initial page is served over SSL, it wants to serve the static content over SSL as well. I also assume that's why it then uses the local IP over https, rather than localhost in the other route.</p>
  <p>My question is, how do I get this to work?</p>
  <ul>
  <li>Is there a header which lets IPFS companion to force it to load over http? If so, I'm assuming this would cause browser security warnings due to mixed content. I have tried adding this header without luck: <em>X-Forwarded-Proto: http</em></li>
  <li>Do I need to do something to enable SSL over 127.0.0.1, connecting this up with my local node? If so, this doesn't seem to be the default setup for clients, and worry that all the content will show broken images if they do not follow some extra steps.</li>
  <li>Is it even possible to serve static content over IPFS from non-IPFS pages?</li>
  </ul>
  <p>Any hints appreciated!</p>
  <p><em>Edit: This appears to effect the Chrome engine and and Firefox.</em></p>