How secret are CIDs and what should I think about hosting user uploaded media on IPFS?

I guess your method is good.

You could also detect if the user is IPFS aware.

One method is the x-ipfs-path HTTP header.

You can try this: http://plesko.si/test/header.php as an example.
With a IPFS aware browser it would just redirect via IPFS, otherwise redirect via HTTP.
The code is fairly simple:
> <?php
> header(‘x-ipfs-path: /ipfs/QmX8DwrfM8D9e3PbBoKjqinjR2jtMT97ewYecu7r9D7jnP’);
> header(‘Location: cat.jpg’);
> ?>

An another way would be to load a JS containing a variable via IPFS and check the variable.
Example: http://plesko.si/test/ipfs-aware.html

You could also use a combination of both: http://plesko.si/test/ipfs-aware2.html
Where it calls a javascript file via the first method, where it outputs the variable as false if it doesn’t recognize the x-ipfs-path.
> <?php
> header(‘x-ipfs-path: /ipfs/QmWWDaXBcCVi16SSTjivkUXZsNU2AZa2Jiajr7kEGZFNsE’);
> header(‘Location: http.js’);
> ?>

Well maybe there are better ways. No idea. :slight_smile:

1 Like