309a943528
* perf: omit search for immutable static requests * perf: also applies to /files * fix: exclude /proxy * /files/:key/*を301 redirectに --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
9 lines
276 B
TypeScript
9 lines
276 B
TypeScript
import type { onRequestHookHandler } from 'fastify';
|
|
|
|
export const handleRequestRedirectToOmitSearch: onRequestHookHandler = (request, reply, done) => {
|
|
const index = request.url.indexOf('?');
|
|
if (~index) {
|
|
reply.redirect(301, request.url.slice(0, index));
|
|
}
|
|
done();
|
|
};
|