mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-03-24 13:03:39 +00:00
* 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>
This commit is contained in:
@@ -313,16 +313,15 @@ export class ApiCallService implements OnApplicationShutdown {
|
||||
}
|
||||
|
||||
if (ep.meta.limit) {
|
||||
let limitActor: string | null;
|
||||
let limitActor: string | null = null;
|
||||
if (user) {
|
||||
limitActor = user.id;
|
||||
} else {
|
||||
if (request.ip === '::1' || request.ip === '127.0.0.1') {
|
||||
console.warn('request ip is localhost, maybe caused by misconfiguration of trustProxy or reverse proxy');
|
||||
limitActor = null;
|
||||
} else {
|
||||
limitActor = getIpHash(request.ip);
|
||||
} else if (this.config.enableIpRateLimit) {
|
||||
if (process.env.NODE_ENV === 'production' && (request.ip === '::1' || request.ip === '127.0.0.1')) {
|
||||
this.logger.warn('Recieved API request from localhost IP address for rate limiting in production environment. This is likely due to an improper trustProxy setting in the config file.');
|
||||
}
|
||||
|
||||
limitActor = getIpHash(request.ip);
|
||||
}
|
||||
|
||||
const limit = Object.assign({}, ep.meta.limit);
|
||||
|
||||
Reference in New Issue
Block a user