cmd/packserver: add --fallback-404 arg for Angular-style SPA support

This commit is contained in:
Laurence Withers 2020-02-15 12:31:42 +00:00
commit f70914aa38
4 changed files with 23 additions and 4 deletions

View file

@ -41,8 +41,15 @@ document.
This can be achieved with a number of methods.
The simplest method is to tell `packserver` itself which resource to use
instead of returning an HTTP 404. Use the command line argument
`--fallback-404 /index.html` (or whichever named resource). The filename must
match a packed resource, so it will be preceded with a `/`. It must exist in
all packfiles being served.
If you have an nginx instance reverse proxying in front of `htpack`, then you
can use a couple of extra directives, for example:
can use a couple of extra directives. This is very flexible as it lets you
override the resource for different routes. For example:
# prevent page loaded at "http://server.example/my-application" from
# requesting resources at "/*" when it should request them at