By default, typical SPA urls (e.g. `/user/1`, `/login`) would return `404 Not Found` as a file does not exist with that path. By marking `index.html` as the SPA you create this rule:
By default, typical SPA urls (e.g. `/user/1`, `/login`) would return `404 Not Found` as a file does not exist with that path. By marking `index.html` as the SPA you create this rule:
*If a static file at the requested path exists (e.g. `/css/style.css`) then serve it, if it does not (e.g. `/login`) then serve the SPA for client-side processing.*
*If a static file at the requested path exists (e.g. `/css/style.css`) then serve it, if it does not (e.g. `/login`) then serve the SPA and handle the route client-side.*
### Access Control
### Access Control
Access to all files is allowed, beside those in the forbidden list (e.g. config files):
By default, access to all files is allowed (including dot files). Use `--forbid` to establish a blacklist:
If a deep structure is involved it may be easier to mount the entire contents of `/build/css` to the `/css` path: (matches any stylesheet path under `/css`, `/css/a`, `/css/a/b` etc.)
```sh
$ ws --rewrite "/css/* -> /build/css/$1"
```
#### Proxied rewrite
If the `to` address contains a hostname local-web-server will act as a proxy - the remote resource will be fetched and returned
Notice you can access <ahref="allowed.html">this page</a>, but not <ahref="admin/blocked.html">this admin page</a> or <ahref="something.php">php file</a>.
By default, typical SPA urls (e.g. `/user/1`, `/login`) would return `404 Not Found` as a file does not exist with that path. By marking `index.html` as the SPA you create this rule:
By default, typical SPA urls (e.g. `/user/1`, `/login`) would return `404 Not Found` as a file does not exist with that path. By marking `index.html` as the SPA you create this rule:
*If a static file at the requested path exists (e.g. `/css/style.css`) then serve it, if it does not (e.g. `/login`) then serve the SPA for client-side processing.*
*If a static file at the requested path exists (e.g. `/css/style.css`) then serve it, if it does not (e.g. `/login`) then serve the SPA and handle the route client-side.*
### Access Control
### Access Control
Access to all files is allowed, beside those in the forbidden list (e.g. config files):
By default, access to all files is allowed (including dot files). Use `--forbid` to establish a blacklist:
If a deep structure is involved it may be easier to mount the entire contents of `/build/css` to the `/css` path: (matches any stylesheet path under `/css`, `/css/a`, `/css/a/b` etc.)
```sh
$ ws --rewrite "/css/* -> /build/css/$1"
```
#### Proxied rewrite
If the `to` address contains a hostname local-web-server will act as a proxy - the remote resource will be fetched and returned