You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: npm start boots up fully operational sw-gateway (#670)
* test: fix test setup
* test: playwright setup is all done in global-setup
* chore: fix lint
* chore: fix depcheck and cleanup code
* chore: re-enable ipns.record fixture loading
* chore: attempt to debug CI failure with ipns record loading
* chore: more ipns record loading debugging
* fix: serve.ts and playwright global setup are normalized
* chore: remove serve.js from prod ignore aegir
* chore: remove unused imports
* chore: fix dep-check
Copy file name to clipboardExpand all lines: README.md
+13-3Lines changed: 13 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,15 +81,25 @@ The main goals of this project are:
81
81
82
82
You can build and run the project locally:
83
83
84
-
85
84
```console
86
85
> npm ci
87
86
> npm start
88
87
```
89
88
90
-
Now open your browser at `http://sw.localhost:3000`
89
+
Now open your browser and go to `http://localhost:3333`
90
+
91
+
Below is an explanation of the different URLs and what they do:
92
+
93
+
With reverse-proxy:
94
+
*`http://localhost:3333` - The service worker gateway front-end served directly with esbuild. (localhost:3333 -> localhost:8345)
95
+
*`http://localhost:3334` - The service worker gateway front-end hosted by an IPFS gateway running on 'localhost:8088'. (localhost:3334 -> localhost:8088 with x-forwarded-host header)
96
+
97
+
Without reverse-proxy:
98
+
*`http://localhost:8345` - The service worker gateway front-end served directly with esbuild.
99
+
100
+
For the above URLs with reverse-proxy, the reverse proxy ensures subdomain support. This ensures you can access URLs like `https://<hash>.ipfs.localhost:<port>/` and `https://<dnslink>.ipns.localhost:<port>/`
91
101
92
-
As you type in a content path, you will be redirected to appropriate URL (typically that means [subdomain style resolution](https://docs.ipfs.tech/how-to/gateway-best-practices/#use-subdomain-gateway-resolution-for-origin-isolation)).
102
+
As you type in a content path, you will be redirected to appropriate URL (typically that means [subdomain style resolution](https://docs.ipfs.tech/how-to/gateway-best-practices/#use-subdomain-gateway-resolution-for-origin-isolation)).
93
103
94
104
For more information about local development setup, see [/docs/DEVELOPMENT.md](/docs/DEVELOPMENT.md).
Copy file name to clipboardExpand all lines: docs/DEVELOPMENT.md
+21-26Lines changed: 21 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,31 +19,26 @@ Make sure you have installed all of the following prerequisites on your developm
19
19
> npm start
20
20
```
21
21
22
-
Now open your browser at `http://sw.localhost:3000`
22
+
Now open your browser at `http://localhost:3333`
23
23
24
+
If you are editing code actively and wanting to see the changes, you will want to use the `3333` port because the IPFS hosted content is generated at build time and the x-forwarded-host header and stubbed DNSLink of `ipfs-host.local` will still be pointing to the old content.
24
25
25
26
### Enabling subdomains
26
27
27
-
You can enable support for subdomains with a simple nginx configuration:
28
+
Subdomains are enabled by default when you run `npm start`. You will want to access the service worker gateway via a reverse proxy that ensures subdomain support:
28
29
29
-
```nginx
30
-
# simple proxy from sw.localhost to localhost:3000
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.
36
+
Unless you have some other reverse proxy setup, you can access a path-only gateway by accessing:
45
37
46
-
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.
38
+
*`http://localhost:8345`
39
+
*`http://127.0.0.1:8345`
40
+
*`http://127.0.0.1:3333`
41
+
*`http://127.0.0.1:3334`
47
42
48
43
## Demo links
49
44
@@ -52,32 +47,32 @@ You can also try <http://sw.localhost/ipns/specs.ipfs.tech> to automatically be
52
47
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.
53
48
54
49
Notes:
55
-
- ⚠️ Deployment of this service worker on environments that don't enable subdomain pathing is not recommended. Path-only gateways do not provide [Origin isolation](https://docs.ipfs.tech/how-to/address-ipfs-on-web/#subdomain-gateway). NEVER use path-only gateways for loading dapps with sensitive information such as keys, passwords, wallets.
50
+
- ⚠️ Deployment of this service worker on environments that don't enable subdomain pathing is not recommended. Path-only gateways do not provide [Origin isolation](https://docs.ipfs.tech/how-to/address-ipfs-on-web/#subdomain-gateway). NEVER use path-only gateways for loading dapps with sensitive information such as keys, passwords, wallets.
56
51
* 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!)
57
52
* 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.
0 commit comments