mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-07-20 10:04:08 +00:00
Cleanup, examples
This commit is contained in:
parent
eac49feb04
commit
7a33e16945
5 changed files with 57 additions and 18 deletions
|
@ -554,15 +554,50 @@ using Let's Encrypt using certbot, or simply because you'd like to share the por
|
|||
Whatever your reasons may be, there are a few things to consider.
|
||||
|
||||
If you are running ntfy behind a proxy, you should set the `behind-proxy` flag. This will instruct the
|
||||
[rate limiting](#rate-limiting) logic to use the `X-Forwarded-For` header as the primary identifier for a visitor,
|
||||
as opposed to the remote IP address. If the `behind-proxy` flag is not set, all visitors will
|
||||
be counted as one, because from the perspective of the ntfy server, they all share the proxy's IP address. If your proxy or CDN provider uses a custom header to securely pass the source IP/Client IP to your application, you can specify that header instead of using the XFF. Using the custom header (unique per provide/cdn/proxy), will disable the use of the XFF header.
|
||||
[rate limiting](#rate-limiting) logic to use the header configured in `proxy-forwarded-header` (default is `X-Forwarded-For`)
|
||||
as the primary identifier for a visitor, as opposed to the remote IP address.
|
||||
|
||||
=== "/etc/ntfy/server.yml"
|
||||
If the `behind-proxy` flag is not set, all visitors will be counted as one, because from the perspective of the
|
||||
ntfy server, they all share the proxy's IP address.
|
||||
|
||||
Relevant flags to consider:
|
||||
|
||||
* `behind-proxy`: if set, ntfy will use the `proxy-forwarded-header` to identify visitors (default: `false`)
|
||||
* `proxy-forwarded-header`: the header to use to identify visitors (default: `X-Forwarded-For`)
|
||||
* `proxy-trusted-addresses`: a comma-separated list of IP addresses that are removed from the forwarded header
|
||||
to determine the real IP address (default: empty)
|
||||
|
||||
=== "/etc/ntfy/server.yml (behind a proxy)"
|
||||
``` yaml
|
||||
# Tell ntfy to use "X-Forwarded-For" to identify visitors
|
||||
# Tell ntfy to use "X-Forwarded-For" header to identify visitors for rate limiting
|
||||
#
|
||||
# Example: If "X-Forwarded-For: 9.9.9.9, 1.2.3.4" is set,
|
||||
# the visitor IP will be 1.2.3.4 (right-most address).
|
||||
#
|
||||
behind-proxy: true
|
||||
proxy-client-ip-header: "X-Client-IP"
|
||||
```
|
||||
|
||||
=== "/etc/ntfy/server.yml (with custom header)"
|
||||
``` yaml
|
||||
# Tell ntfy to use "X-Client-IP" header to identify visitors for rate limiting
|
||||
#
|
||||
# Example: If "X-Client-IP: 9.9.9.9" is set,
|
||||
# the visitor IP will be 9.9.9.9.
|
||||
#
|
||||
behind-proxy: true
|
||||
proxy-forwarded-header: "X-Client-IP"
|
||||
```
|
||||
|
||||
=== "/etc/ntfy/server.yml (multiple proxies)"
|
||||
``` yaml
|
||||
# Tell ntfy to use "X-Forwarded-For" header to identify visitors for rate limiting,
|
||||
# and to strip the IP addresses of the proxies 1.2.3.4 and 1.2.3.5
|
||||
#
|
||||
# Example: If "X-Forwarded-For: 9.9.9.9, 1.2.3.4" is set,
|
||||
# the visitor IP will be 9.9.9.9 (right-most unknown address).
|
||||
#
|
||||
behind-proxy: true
|
||||
proxy-trusted-addresses: "1.2.3.4, 1.2.3.5"
|
||||
```
|
||||
|
||||
### TLS/SSL
|
||||
|
@ -1391,7 +1426,9 @@ variable before running the `ntfy` command (e.g. `export NTFY_LISTEN_HTTP=:80`).
|
|||
| `cache-batch-timeout` | `NTFY_CACHE_BATCH_TIMEOUT` | *duration* | 0s | Timeout for batched async writes to the message cache (if zero, writes are synchronous) |
|
||||
| `auth-file` | `NTFY_AUTH_FILE` | *filename* | - | Auth database file used for access control. If set, enables authentication and access control. See [access control](#access-control). |
|
||||
| `auth-default-access` | `NTFY_AUTH_DEFAULT_ACCESS` | `read-write`, `read-only`, `write-only`, `deny-all` | `read-write` | Default permissions if no matching entries in the auth database are found. Default is `read-write`. |
|
||||
| `behind-proxy` | `NTFY_BEHIND_PROXY` | *bool* | false | If set, the X-Forwarded-For header is used to determine the visitor IP address instead of the remote address of the connection. |
|
||||
| `behind-proxy` | `NTFY_BEHIND_PROXY` | *bool* | false | If set, use forwarded header (e.g. X-Forwarded-For, X-Client-IP) to determine visitor IP address (for rate limiting) |
|
||||
| `proxy-forwarded-header` | `NTFY_PROXY_FORWARDED_HEADER` | *string* | `X-Forwarded-For` | Use specified header to determine visitor IP address (for rate limiting) |
|
||||
| `proxy-trusted-addresses` | `NTFY_PROXY_TRUSTED_ADDRESSES` | *comma-separated list of IPs* | - | Comma-separated list of trusted IP addresses to remove from forwarded header |
|
||||
| `attachment-cache-dir` | `NTFY_ATTACHMENT_CACHE_DIR` | *directory* | - | Cache directory for attached files. To enable attachments, this has to be set. |
|
||||
| `attachment-total-size-limit` | `NTFY_ATTACHMENT_TOTAL_SIZE_LIMIT` | *size* | 5G | Limit of the on-disk attachment cache directory. If the limits is exceeded, new attachments will be rejected. |
|
||||
| `attachment-file-size-limit` | `NTFY_ATTACHMENT_FILE_SIZE_LIMIT` | *size* | 15M | Per-file attachment size limit (e.g. 300k, 2M, 100M). Larger attachment will be rejected. |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue