Skip to content

Commit 897cfcf

Browse files
authored
docs(v2): update docs for v2.44.1 to v2.44.3 changes (#25)
1 parent fd7eb78 commit 897cfcf

15 files changed

Lines changed: 57 additions & 26 deletions

‎src/v2/building-from-source.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ However, you can disable just the ones you don't need from the lists below.
3333
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
3434
| **Default** | |
3535
| `default` | Activates the default features by omission. |
36-
| `all` | Activates all available features including the `experimental` feature. This is the default feature used when building SWS binaries. |
37-
| `experimental` | Activates all SWS experimental features. Make sure to also provide the required `RUSTFLAGS` if the feature requires so. |
36+
| `all` | Activates the default features and the Tokio runtime metrics, but not the `experimental` feature. This is the feature used when building SWS binaries. |
37+
| `experimental` | Activates all SWS experimental features (in-memory file cache and Tokio runtime metrics), not included in SWS binaries. Provide the required `RUSTFLAGS` if needed. |
3838
| [**HTTP2/TLS**](./features/http2-tls.md) | |
3939
| `http2` | Activates the HTTP2 and TLS feature. Requires exactly one of `http2-ring` or `http2-fips` to select a TLS crypto provider. |
4040
| `http2-ring` | Activates the HTTP2/TLS feature with [`ring`](https://github.com/briansmith/ring) as the TLS crypto provider. Included by default. |

‎src/v2/configuration/command-line-arguments.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Options:
7777
--directory-listing-download=<DIRECTORY_LISTING_DOWNLOAD>
7878
Specify list of enabled format(s) for directory download. Format supported: `targz`. Default to empty list (disabled) [env: SERVER_DIRECTORY_LISTING_DOWNLOAD=] [possible values: targz]
7979
--security-headers [<SECURITY_HEADERS>]
80-
Enable security headers by default when HTTP/2 feature is activated. Headers included: "Strict-Transport-Security: max-age=63072000; includeSubDomains; preload" (2 years max-age), "X-Frame-Options: DENY" and "Content-Security-Policy: frame-ancestors 'self'" [env: SERVER_SECURITY_HEADERS=] [default: false] [possible values: true, false]
80+
Enable security headers. Enabled by default when HTTP/2 (`--http2`) is activated. Headers included: "X-Frame-Options: DENY", "X-Content-Type-Options: nosniff" and "Content-Security-Policy: frame-ancestors 'self'". With `--http2` (TLS), also "Strict-Transport-Security: max-age=63072000; includeSubDomains; preload" (2 years max-age), which is never sent over plain HTTP. Behind a TLS-terminating proxy, add `Strict-Transport-Security` at the proxy or with an `[[advanced.headers]]` rule [env: SERVER_SECURITY_HEADERS=] [default: false] [possible values: true, false]
8181
-e, --cache-control-headers [<CACHE_CONTROL_HEADERS>]
8282
Enable cache control headers for incoming requests based on a set of file types. The file type list can be found on `src/control_headers.rs` file [env: SERVER_CACHE_CONTROL_HEADERS=] [default: true] [possible values: true, false]
8383
--basic-auth <BASIC_AUTH>
@@ -89,11 +89,11 @@ Options:
8989
--log-remote-address [<LOG_REMOTE_ADDRESS>]
9090
Log incoming requests information along with its remote address if available using the `info` log level [env: SERVER_LOG_REMOTE_ADDRESS=] [default: false] [possible values: true, false]
9191
--log-x-real-ip [<LOG_X_REAL_IP>]
92-
Log the X-Real-IP header for remote IP information [env: SERVER_LOG_X_REAL_IP=] [default: false] [possible values: true, false]
92+
Log the X-Real-IP header of requests from --trusted-proxies [env: SERVER_LOG_X_REAL_IP=] [default: false] [possible values: true, false]
9393
--log-forwarded-for [<LOG_FORWARDED_FOR>]
94-
Log the X-Forwarded-For header for remote IP information [env: SERVER_LOG_FORWARDED_FOR=] [default: false] [possible values: true, false]
94+
Log the first X-Forwarded-For address of requests from --trusted-proxies [env: SERVER_LOG_FORWARDED_FOR=] [default: false] [possible values: true, false]
9595
--trusted-proxies <TRUSTED_PROXIES>
96-
List of IPs to use X-Forwarded-For from. The default is to trust all [env: SERVER_TRUSTED_PROXIES=]
96+
List of proxy IPs to use the X-Real-IP and X-Forwarded-For headers from. The default trusts no one, so the headers are not logged unless set. IPv4 entries also match their IPv4-mapped IPv6 form (`::ffff:a.b.c.d`) [env: SERVER_TRUSTED_PROXIES=]
9797
--redirect-trailing-slash [<REDIRECT_TRAILING_SLASH>]
9898
Check for a trailing slash in the requested directory URI and redirect permanently (308) to the same path with a trailing slash suffix if it is missing [env: SERVER_REDIRECT_TRAILING_SLASH=] [default: true] [possible values: true, false]
9999
--ignore-hidden-files [<IGNORE_HIDDEN_FILES>]

‎src/v2/configuration/config-file.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ log-remote-address = false
8686
#### Log real IP from X-Forwarded-For header if available
8787
log-forwarded-for = false
8888

89-
#### IPs to accept the X-Forwarded-For header from. Empty means all
89+
#### Proxy IPs to use the X-Real-IP and X-Forwarded-For headers from. Empty means none
9090
trusted-proxies = []
9191

9292
#### Redirect to trailing slash in the requested directory uri

‎src/v2/configuration/environment-variables.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ Log incoming request information along with its Remote Address (IP) if available
4545

4646
## SERVER_LOG_X_REAL_IP
4747

48-
Log the X-Real-IP header if available using the `info` log level. Default `false`.
48+
Log the X-Real-IP header of requests from [trusted proxies](#server_trusted_proxies) using the `info` log level. Default `false`.
4949

5050
## SERVER_LOG_FORWARDED_FOR
5151

52-
Log the X-Forwarded-For header if available using the `info` log level. Default `false`.
52+
Log the first X-Forwarded-For address of requests from [trusted proxies](#server_trusted_proxies) using the `info` log level. Default `false`.
5353

5454
## SERVER_TRUSTED_PROXIES
5555

56-
A comma separated list of IP addresses to accept the X-Forwarded-For header from. An empty string means trust all IPs. Default `""`
56+
A comma separated list of proxy IP addresses to use the X-Real-IP and X-Forwarded-For headers from. An empty string trusts no one, so the headers are not logged. IPv4 entries also match their IPv4-mapped IPv6 form (`::ffff:a.b.c.d`). Default `""`
5757

5858
## SERVER_ERROR_PAGE_404
5959

@@ -147,7 +147,7 @@ Specify list of enabled format(s) for directory download. Format supported: `tar
147147

148148
## SERVER_SECURITY_HEADERS
149149

150-
Enable security headers by default when the HTTP/2 feature is activated. Headers included: `Strict-Transport-Security: max-age=63072000; includeSubDomains; preload` (2 years max-age), `X-Frame-Options: DENY` and `Content-Security-Policy: frame-ancestors 'self'`. Default `false` (disabled).
150+
Enable security headers. Enabled by default when HTTP/2 (`--http2`) is activated. Headers included: `X-Frame-Options: DENY`, `X-Content-Type-Options: nosniff` and `Content-Security-Policy: frame-ancestors 'self'`. With `--http2` (TLS), also `Strict-Transport-Security: max-age=63072000; includeSubDomains; preload` (2 years max-age), which is never sent over plain HTTP. Default `false` (disabled).
151151

152152
## SERVER_CACHE_CONTROL_HEADERS
153153

‎src/v2/features/basic-authentication.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ htpasswd -nBC10 "username"
4444
> If you are using `SERVER_BASIC_AUTH` env via a `docker-compose.yml` file don't forget to replace the single `$` (dollar sign) with a `$$` (double-dollar sign) if you want those individual `$` dollar signs in your configuration to be treated by Docker as literals.<br>
4545
> More details in [the Docker Compose file: variable substitution](https://docs.docker.com/compose/compose-file/compose-file-v2/#variable-substitution) page.
4646
47+
> [!INFO] OPTIONS requests
48+
>
49+
> `OPTIONS` requests also require credentials, except CORS preflight requests (with `Origin` and `Access-Control-Request-Method` headers) when [CORS](./cors.md) is enabled.
50+
4751
Finally, assign the credentials and run the server.
4852

4953
```sh

‎src/v2/features/cache-control-headers.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ This feature is enabled by default and can be controlled by the boolean `-e, --c
1616

1717
Control headers are applied only to the following file types with the corresponding `max-age` values.
1818

19+
They are only applied to `2xx` and `304` responses. Other responses (e.g. `404`) get `Cache-Control: no-cache`.
20+
1921
### One day
2022

2123
A `max-age` of _one day_ duration is used by default.

‎src/v2/features/compression.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ Compression is only applied to files with the MIME types listed below, indicatin
4848
- `image/x-icon`
4949
- `image/vnd.microsoft.icon`
5050

51+
## Responses not compressed
52+
53+
Partial content (`206`) responses and responses without a body (`1xx`, `204`, `304`) are not compressed.
54+
5155
## Compression level
5256

5357
SWS allows selecting the compression level via `--compression-level` command line option or the equivalent [SERVER_COMPRESSION_LEVEL](../configuration/environment-variables.md#server_compression_level) env. The available values are `fastest`, `best` and `default`. `fastest` will result in the lowest CPU load but also the worst compression factor. `best` will attempt to compress the data as much as possible (not recommended with `Brotli` or `Zstandard` compression, will be very slow). `default` tries to strike a balance, choosing a compression level where compression factor is already fairly good but the CPU load is still low.

‎src/v2/features/directory-listing.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,5 @@ static-web-server \
143143
```
144144

145145
When **Directory Download** is enabled, append `?download` to a directory URL to download it. A link will also be added to the top part of **HTML** output format.
146+
147+
Symlinks resolving outside the root directory are not included in the archive.

‎src/v2/features/http-methods.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ outline: deep
88

99
## OPTIONS Method
1010

11+
> [!INFO] Basic Authentication
12+
>
13+
> When [Basic Authentication](./basic-authentication.md) is enabled, `OPTIONS` requests also require credentials, except [CORS preflight requests](#preflight-requests-in-cors) when [CORS](./cors.md) is enabled.
14+
1115
### Identifying allowed request methods
1216

1317
The HTTP [OPTIONS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS) method can be used to send a request to check for permitted communication options for either a given URL or server.

‎src/v2/features/http1.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ The HTTP/1 is the protocol by default and can be used by specifying a host addre
77
> - Either `--host`, `--port` and `--root` have defaults (optional values) so they can be specified or omitted as required.
88
> - The server provides [Termination Signal](https://www.gnu.org/software/libc/manual/html_node/Termination-Signals.html) handling with [Graceful Shutdown](https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-terminating-with-grace) ability by default.
99
10+
The plain HTTP listener only serves HTTP/1. HTTP/2 requires TLS, see [HTTP/2 and TLS](./http2-tls.md).
11+
12+
HTTP/1 request headers are bounded by a 64 KiB read buffer. Larger requests get a `431 Request Header Fields Too Large` response.
13+
1014
Below is an example of how to run the server using HTTP/1.
1115

1216
```sh

0 commit comments

Comments
 (0)