How do I host my own preload nodes?

I find that the major way js-ipfs transferring data is through preload nodes hosted on ipfs dot io
Is there any way to host my own preload nodes in case that the ipfs dot io nodes become unstable?

Yes.

  1. Setup a go-ipfs node on a server, like https://blog.ipfs.io/22-run-ipfs-on-a-vps/ or on your own machine.

  2. Connect your js-ipfs node to your go-ipfs server via websocket, such as await node.swarm.connect(multiaddr); where multiaddr is /dns4/yourserver.com/tcp/443/wss/p2p/QmYourPeeridHash

  3. Fetch the content (goto the URL, use fetch, use cURL, whatever you please)

  4. The content will be available on other gateways shortly after that as go-ipfs does its magic across the globe.

and then POST https://preload.server.com/api/v0/refs?r=true&arg=bafy… from js-ipfs