Fix mistake in config access for workaroundCloudflare504TimeoutErrors (#229)

Follow-up to https://github.com/matrix-org/matrix-public-archive/pull/228
This commit is contained in:
Eric Eastwood 2023-05-11 16:34:16 -05:00 committed by GitHub
parent e96f36a1a6
commit f05d36e9f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -15,6 +15,7 @@ const basePath = config.get('basePath');
assert(basePath);
const requestTimeoutMs = config.get('requestTimeoutMs');
assert(requestTimeoutMs);
const workaroundCloudflare504TimeoutErrors = config.get('workaroundCloudflare504TimeoutErrors');
// Based off of the `connect-timeout` middleware,
// https://github.com/expressjs/timeout/blob/f2f520f335f2f2ae255d4778e908e8d38e3a4e68/index.js
@ -111,7 +112,7 @@ async function timeoutMiddleware(req, res, next) {
//
// We want to show our own timeout page because it has more information about what
// went wrong (e.g. which external Matrix API requests were slow).
res.status(config.workaroundCloudflare504TimeoutErrors ? 500 : 504);
res.status(workaroundCloudflare504TimeoutErrors ? 500 : 504);
res.set('Content-Type', 'text/html');