docs: clarify self-hosting

This commit is contained in:
Nolan Lawson 2022-11-12 12:28:19 -08:00 committed by GitHub
parent 68d756ca34
commit 7ea387bc4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -94,12 +94,13 @@ To keep your version of Pinafore up to date, you can use `git` to check out the
Pinafore is a static site. When you run `yarn build`, static files will be Pinafore is a static site. When you run `yarn build`, static files will be
written to `__sapper__/export`. written to `__sapper__/export`.
In theory you could host these static files yourself (e.g. using nginx or Apache), but It is _not_ recommended to directly expose these files when self-hosting. Instead, you should use `node server.js` (e.g. with an
it's not recommended, because: nginx or Apache proxy in front). This adds several things you don't get from the raw static files:
- You'd have to set the [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) headers yourself, - [CSP headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) (important for security)
which are an important security feature. - Certain dynamic routes (less important because of Service Worker managing routing, but certain things could break if Service Workers are disabled in the user's browser)
- Some routes are dynamic and need to be routed to the correct static file.
Having an [nginx config generator](https://github.com/nolanlawson/pinafore/issues/1878) is currently an open issue.
## Developing and testing ## Developing and testing