Skip to content

Latest commit

 

History

History
84 lines (53 loc) · 3.48 KB

DEVELOPMENT.md

File metadata and controls

84 lines (53 loc) · 3.48 KB

Developer Notes

This page shows how to set up basic development environment and how to test this project.

Getting Started

Prerequisites

Make sure you have installed all of the following prerequisites on your development machine:

Installation and Running example

> npm install
> npm start

Now open your browser at http://sw.localhost:3000

Enabling subdomains

You can enable support for subdomains with a simple nginx configuration:

    # simple proxy from sw.localhost to localhost:3000
    server {
        listen       80;

        server_name ~^(?<subdomain>.+)\.ipfs\.sw.localhost$ ~^(?<subdomain>.+)\.ipns\.sw.localhost$ .sw.localhost;

        location / {
            proxy_pass http://localhost:3000;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $remote_addr;
        }
    }

You can then run npm start, start your nginx server, and then visit http://specs-ipfs-tech.ipns.sw.localhost in your browser to load the specs.ipfs.tech website via Helia-based verified-fetch library, completely from the Service Worker.

You can also try http://sw.localhost/ipns/specs.ipfs.tech to automatically be redirected to http://specs-ipfs-tech.ipns.sw.localhost. If you are not redirected, your reverse proxy may not be set up correctly.

Demo links

Pre-reqs

You have to visit the landing page first, and make sure the SW is loaded. Once it is, the below links should work for you.

Notes:

  • ⚠️ Deployment of this service worker on environments that don't enable subdomain pathing is not recommended. Path-only gateways do not provide Origin isolation. NEVER use path-only gateways for loading dapps with sensitive information such as keys, passwords, wallets.
  • Attempting a few refreshes, clearing site data (cache/cookies/sw/indexDb/etc..), etc, may resolve your problem (though may be indicative of issues you can fix with a PR!)
  • Some content-types are not previewable with certain browsers. If you receive a download prompt you didn't expect: double check the returned content-type and make sure your browser supports previewing that content-type.

Links

Static website and it's nested content

Single images

Videos

IPNS paths

DNSLink paths

  • TBD