Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
},
"push_ephemeral": true,
"rate_limiting_window": 10000,
"rate_limiting_nb_requests": 100
"rate_limiting_nb_requests": 100,
"trust_x_forwarded_for": false
}
3 changes: 2 additions & 1 deletion packages/matrix-application-server/src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"namespaces": { "users": [] },
"push_ephemeral": true,
"rate_limiting_window": 600000,
"rate_limiting_nb_requests": 100
"rate_limiting_nb_requests": 100,
"trust_x_forwarded_for": false
}
1 change: 1 addition & 0 deletions packages/matrix-application-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface Config {
push_ephemeral?: boolean
rate_limiting_window?: number
rate_limiting_nb_requests?: number
trust_x_forwarded_for?: boolean
}

export { type ClientEvent } from './interfaces'
Expand Down
5 changes: 4 additions & 1 deletion packages/matrix-application-server/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ export default class MASRouter {
constructor(private readonly _appServer: MatrixApplicationServer) {
this.rateLimiter = rateLimit({
windowMs: this._appServer.conf.rate_limiting_window,
limit: this._appServer.conf.rate_limiting_nb_requests
limit: this._appServer.conf.rate_limiting_nb_requests,
validate: {
trustProxy: this._appServer.conf.trust_x_forwarded_for
}
})
this.defaultAuthMiddleware = auth(
this._appServer.appServiceRegistration.hsToken,
Expand Down