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
{{ message }}
Repository navigation
Commit 897cfcf
Browse filesBrowse the repository at this point in the historyBrowse files
|`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.|
38
38
|[**HTTP2/TLS**](./features/http2-tls.md)||
39
39
|`http2`| Activates the HTTP2 and TLS feature. Requires exactly one of `http2-ring` or `http2-fips` to select a TLS crypto provider. |
40
40
|`http2-ring`| Activates the HTTP2/TLS feature with [`ring`](https://github.com/briansmith/ring) as the TLS crypto provider. Included by default. |
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]
79
79
--security-headers [<SECURITY_HEADERS>]
80
-
Enable security headersby 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]
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]
83
83
--basic-auth <BASIC_AUTH>
@@ -89,11 +89,11 @@ Options:
89
89
--log-remote-address [<LOG_REMOTE_ADDRESS>]
90
90
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]
91
91
--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]
93
93
--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]
95
95
--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=]
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]
Copy file name to clipboardExpand all lines: src/v2/configuration/environment-variables.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,15 +45,15 @@ Log incoming request information along with its Remote Address (IP) if available
45
45
46
46
## SERVER_LOG_X_REAL_IP
47
47
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`.
49
49
50
50
## SERVER_LOG_FORWARDED_FOR
51
51
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`.
53
53
54
54
## SERVER_TRUSTED_PROXIES
55
55
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 `""`
57
57
58
58
## SERVER_ERROR_PAGE_404
59
59
@@ -147,7 +147,7 @@ Specify list of enabled format(s) for directory download. Format supported: `tar
147
147
148
148
## SERVER_SECURITY_HEADERS
149
149
150
-
Enable security headersby 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).
Copy file name to clipboardExpand all lines: src/v2/features/basic-authentication.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,10 @@ htpasswd -nBC10 "username"
44
44
> 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>
45
45
> More details in [the Docker Compose file: variable substitution](https://docs.docker.com/compose/compose-file/compose-file-v2/#variable-substitution) page.
46
46
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
+
47
51
Finally, assign the credentials and run the server.
Copy file name to clipboardExpand all lines: src/v2/features/compression.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,10 @@ Compression is only applied to files with the MIME types listed below, indicatin
48
48
-`image/x-icon`
49
49
-`image/vnd.microsoft.icon`
50
50
51
+
## Responses not compressed
52
+
53
+
Partial content (`206`) responses and responses without a body (`1xx`, `204`, `304`) are not compressed.
54
+
51
55
## Compression level
52
56
53
57
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.
Copy file name to clipboardExpand all lines: src/v2/features/directory-listing.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,3 +143,5 @@ static-web-server \
143
143
```
144
144
145
145
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.
Copy file name to clipboardExpand all lines: src/v2/features/http-methods.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,10 @@ outline: deep
8
8
9
9
## OPTIONS Method
10
10
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
+
11
15
### Identifying allowed request methods
12
16
13
17
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.
Copy file name to clipboardExpand all lines: src/v2/features/http1.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,10 @@ The HTTP/1 is the protocol by default and can be used by specifying a host addre
7
7
> - Either `--host`, `--port` and `--root` have defaults (optional values) so they can be specified or omitted as required.
8
8
> - 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.
9
9
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
+
10
14
Below is an example of how to run the server using HTTP/1.
0 commit comments