mirror of
https://github.com/Infisical/infisical.git
synced 2025-04-17 19:37:38 +00:00
fix: update audit log endpoint and nginx timeout to handle lengthy queries
This commit is contained in:
6
backend/src/server/lib/utils.ts
Normal file
6
backend/src/server/lib/utils.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export const extendTimeout =
|
||||
(timeoutMs: number) =>
|
||||
(request: { raw: { socket: { setTimeout: (ms: number) => void } } }, reply: unknown, done: () => void) => {
|
||||
request.raw.socket.setTimeout(timeoutMs);
|
||||
done();
|
||||
};
|
@ -14,6 +14,7 @@ import { AUDIT_LOGS, ORGANIZATIONS } from "@app/lib/api-docs";
|
||||
import { getLastMidnightDateISO, removeTrailingSlash } from "@app/lib/fn";
|
||||
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||
import { slugSchema } from "@app/server/lib/schemas";
|
||||
import { extendTimeout } from "@app/server/lib/utils";
|
||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||
import { ActorType, AuthMode, MfaMethod } from "@app/services/auth/auth-type";
|
||||
import { sanitizedOrganizationSchema } from "@app/services/org/org-schema";
|
||||
@ -108,6 +109,7 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
||||
config: {
|
||||
rateLimit: readLimit
|
||||
},
|
||||
preHandler: extendTimeout(121000), // 2 mins (query timeout) with padding
|
||||
schema: {
|
||||
description: "Get all audit logs for an organization",
|
||||
querystring: z.object({
|
||||
|
@ -106,7 +106,7 @@ export const LogsTable = ({
|
||||
className="mb-20 mt-4 px-4 py-3 text-sm"
|
||||
isFullWidth
|
||||
variant="star"
|
||||
isLoading={isFetchingNextPage}
|
||||
isLoading={isFetchingNextPage || isPending}
|
||||
isDisabled={isFetchingNextPage || !hasNextPage}
|
||||
onClick={() => fetchNextPage()}
|
||||
>
|
||||
|
@ -15,6 +15,21 @@ server {
|
||||
proxy_cookie_path / "/; HttpOnly; SameSite=strict";
|
||||
}
|
||||
|
||||
location /api/v1/organization/audit-logs {
|
||||
proxy_set_header X-Real-RIP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-NginX-Proxy true;
|
||||
|
||||
proxy_pass http://backend:4000;
|
||||
proxy_redirect off;
|
||||
|
||||
proxy_cookie_path / "/; HttpOnly; SameSite=strict";
|
||||
|
||||
proxy_read_timeout 121s; # query timeout with padding
|
||||
}
|
||||
|
||||
location /api/v3/migrate {
|
||||
client_max_body_size 25M;
|
||||
|
||||
|
@ -17,6 +17,21 @@ server {
|
||||
proxy_cookie_path / "/; HttpOnly; SameSite=strict";
|
||||
}
|
||||
|
||||
location /api/v1/organization/audit-logs {
|
||||
proxy_set_header X-Real-RIP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-NginX-Proxy true;
|
||||
|
||||
proxy_pass http://backend:4000;
|
||||
proxy_redirect off;
|
||||
|
||||
proxy_cookie_path / "/; HttpOnly; SameSite=strict";
|
||||
|
||||
proxy_read_timeout 121s; # query timeout with padding
|
||||
}
|
||||
|
||||
location /runtime-ui-env.js {
|
||||
proxy_set_header X-Real-RIP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
Reference in New Issue
Block a user