summaryrefslogtreecommitdiff
path: root/packages/backend/src/config.ts
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2025-12-20 19:07:05 +0900
committerGitHub <noreply@github.com>2025-12-20 19:07:05 +0900
commitee8dccea2ffb151636e520f71b7dfe2b91e06c71 (patch)
tree920d627b4d1f246684c799cc5312fbd99cc689b6 /packages/backend/src/config.ts
parentfix(frontend): iPadOSのPWAでアプリを切り替えた際にウィジェ... (diff)
downloadmisskey-ee8dccea2ffb151636e520f71b7dfe2b91e06c71.tar.gz
misskey-ee8dccea2ffb151636e520f71b7dfe2b91e06c71.tar.bz2
misskey-ee8dccea2ffb151636e520f71b7dfe2b91e06c71.zip
fix(backend): fix #16994 by approach 6 (#17005)
* fix(backend): narrow down trustproxy default value and enhance documentation on how to configure it * Update Changelog * indent [ci skip] * Update CHANGELOG.md [ci skip] * add cloudflare specific example * Update .config/example.yml Co-authored-by: anatawa12 <anatawa12@icloud.com> * fix: productionでIPレートリミットされる際にlocalhostからリクエストが来たらログを残すように * fix: wrong condition * fix: use own logger for signin api * flip configuration * fix * fix [ci skip] * fix: wrong message [ci skip] * fix: どこがおかしいか明記 [ci skip] --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
Diffstat (limited to 'packages/backend/src/config.ts')
-rw-r--r--packages/backend/src/config.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/packages/backend/src/config.ts b/packages/backend/src/config.ts
index f9852d3578..657d7869fa 100644
--- a/packages/backend/src/config.ts
+++ b/packages/backend/src/config.ts
@@ -30,6 +30,7 @@ type Source = {
socket?: string;
trustProxy?: FastifyServerOptions['trustProxy'];
chmodSocket?: string;
+ enableIpRateLimit?: boolean;
disableHsts?: boolean;
db: {
host: string;
@@ -120,8 +121,9 @@ export type Config = {
url: string;
port: number;
socket: string | undefined;
- trustProxy: FastifyServerOptions['trustProxy'];
+ trustProxy: NonNullable<FastifyServerOptions['trustProxy']>;
chmodSocket: string | undefined;
+ enableIpRateLimit: boolean;
disableHsts: boolean | undefined;
db: {
host: string;
@@ -263,9 +265,17 @@ export function loadConfig(): Config {
url: url.origin,
port: config.port ?? parseInt(process.env.PORT ?? '', 10),
socket: config.socket,
- trustProxy: config.trustProxy,
+ trustProxy: config.trustProxy ?? [
+ '10.0.0.0/8',
+ '172.16.0.0/12',
+ '192.168.0.0/16',
+ '127.0.0.1/32',
+ '::1/128',
+ 'fc00::/7',
+ ],
chmodSocket: config.chmodSocket,
disableHsts: config.disableHsts,
+ enableIpRateLimit: config.enableIpRateLimit ?? true,
host,
hostname,
scheme,