diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2025-06-13 23:18:06 -0400 |
|---|---|---|
| committer | Hazelnoot <acomputerdog@gmail.com> | 2025-06-13 23:18:06 -0400 |
| commit | b44abe0eaaeb85111d94046b182e03e67993a101 (patch) | |
| tree | 0d84360a061434aedcdb41db3076764bb8292ce4 /packages/backend/src/server/api/ApiCallService.ts | |
| parent | merge: Fix uncaught exception hooks and add more shutdown logging. (!1111) (diff) | |
| download | sharkey-b44abe0eaaeb85111d94046b182e03e67993a101.tar.gz sharkey-b44abe0eaaeb85111d94046b182e03e67993a101.tar.bz2 sharkey-b44abe0eaaeb85111d94046b182e03e67993a101.zip | |
set X-Robots-Tag to disable indexing API endpoints
Diffstat (limited to 'packages/backend/src/server/api/ApiCallService.ts')
| -rw-r--r-- | packages/backend/src/server/api/ApiCallService.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/backend/src/server/api/ApiCallService.ts b/packages/backend/src/server/api/ApiCallService.ts index 6d6c86bb82..66d968224a 100644 --- a/packages/backend/src/server/api/ApiCallService.ts +++ b/packages/backend/src/server/api/ApiCallService.ts @@ -148,6 +148,10 @@ export class ApiCallService implements OnApplicationShutdown { request: FastifyRequest<{ Body: Record<string, unknown> | undefined, Querystring: Record<string, unknown> }>, reply: FastifyReply, ): void { + // Tell crawlers not to index API endpoints. + // https://developers.google.com/search/docs/crawling-indexing/block-indexing + reply.header('X-Robots-Tag', 'noindex'); + const body = request.method === 'GET' ? request.query : request.body; |