matrix-public-archive/server/middleware
Eric Eastwood 9078abf4f1
Timeout requests and stop processing further (#204)
Fix https://github.com/matrix-org/matrix-public-archive/issues/148
Fix https://github.com/matrix-org/matrix-public-archive/issues/40

 - Apply timeout middleware to all room directory and room routes
 - Stop messing with the response after we timeout. Fix https://github.com/matrix-org/matrix-public-archive/issues/148
    - This also involves cancelling any `async/await` things like requests in the routes so we throw an abort error instead of continuing on. Fix https://github.com/matrix-org/matrix-public-archive/issues/40
 - Also abort the route if we see that the user closed the request before we could respond to them
 - Bumps minimum supported Node.js version to v18 because we're now using the built-in native `fetch` in Node.js vs `node-fetch`. This gives us the custom `signal.reason` that we aborted with instead of a generic `AbortError`.
    - This also means we had to add some instrumentation for `fetch` which uses `undici` under the hood. Settled on some unofficial instrumentation: [`opentelemetry-instrumentation-fetch-node`](https://www.npmjs.com/package/opentelemetry-instrumentation-fetch-node)
2023-05-02 00:39:01 -05:00
..
content-security-policy-middleware.js Add route identifiers for easy metric reporting (#173) 2023-04-19 15:09:51 -05:00
identify-route-middleware.js Add route identifiers for easy metric reporting (#173) 2023-04-19 15:09:51 -05:00
prevent-clickjacking-middleware.js Add route identifiers for easy metric reporting (#173) 2023-04-19 15:09:51 -05:00
redirect-to-correct-archive-url-if-bad-sigil-middleware.js Add route identifiers for easy metric reporting (#173) 2023-04-19 15:09:51 -05:00
timeout-middleware.js Timeout requests and stop processing further (#204) 2023-05-02 00:39:01 -05:00