From 1694a9b8444b94703a42b0415f62060a556299df Mon Sep 17 00:00:00 2001 From: maslow Date: Tue, 31 Jan 2023 15:46:06 +0800 Subject: [PATCH] fix: fix max header size bug in gw & server --- deploy/build/charts/apisix/values.yaml | 2 ++ deploy/build/charts/casdoor/templates/init_data.yaml | 7 ------- server/src/auth/casdoor.service.ts | 2 +- ...compile-function.dto.ts.ts => compile-function.dto.ts} | 0 server/src/function/function.controller.ts | 2 +- server/src/function/function.service.ts | 2 +- server/src/instance/instance.service.ts | 8 ++++++-- 7 files changed, 11 insertions(+), 12 deletions(-) rename server/src/function/dto/{compile-function.dto.ts.ts => compile-function.dto.ts} (100%) diff --git a/deploy/build/charts/apisix/values.yaml b/deploy/build/charts/apisix/values.yaml index 1081074731..d746a89c0f 100644 --- a/deploy/build/charts/apisix/values.yaml +++ b/deploy/build/charts/apisix/values.yaml @@ -403,6 +403,8 @@ configurationSnippet: main: | httpStart: | + client_header_buffer_size 1024k; + large_client_header_buffers 8 128k; httpEnd: | diff --git a/deploy/build/charts/casdoor/templates/init_data.yaml b/deploy/build/charts/casdoor/templates/init_data.yaml index d0ca29ef85..84efcfd119 100644 --- a/deploy/build/charts/casdoor/templates/init_data.yaml +++ b/deploy/build/charts/casdoor/templates/init_data.yaml @@ -47,13 +47,6 @@ data: "prompted": false, "rule": "None" }, - { - "name": "Display name", - "visible": true, - "required": true, - "prompted": false, - "rule": "None" - }, { "name": "Password", "visible": true, diff --git a/server/src/auth/casdoor.service.ts b/server/src/auth/casdoor.service.ts index 3781236b75..841c8ade2c 100644 --- a/server/src/auth/casdoor.service.ts +++ b/server/src/auth/casdoor.service.ts @@ -87,7 +87,7 @@ export class CasdoorService { const endpoint = ServerConfig.CASDOOR_ENDPOINT const query = { client_id: ServerConfig.CASDOOR_CLIENT_ID, - redirect_uri: process.env.CASDOOR_REDIRECT_URI, + redirect_uri: ServerConfig.CASDOOR_REDIRECT_URI, response_type: 'code', scope: 'openid,profile,phone,email', state: 'casdoor', diff --git a/server/src/function/dto/compile-function.dto.ts.ts b/server/src/function/dto/compile-function.dto.ts similarity index 100% rename from server/src/function/dto/compile-function.dto.ts.ts rename to server/src/function/dto/compile-function.dto.ts diff --git a/server/src/function/function.controller.ts b/server/src/function/function.controller.ts index 26345bf5f4..a07ecc629d 100644 --- a/server/src/function/function.controller.ts +++ b/server/src/function/function.controller.ts @@ -24,7 +24,7 @@ import { JwtAuthGuard } from '../auth/jwt.auth.guard' import { ApplicationAuthGuard } from '../auth/application.auth.guard' import { FunctionService } from './function.service' import { IRequest } from '../utils/interface' -import { CompileFunctionDto } from './dto/compile-function.dto.ts' +import { CompileFunctionDto } from './dto/compile-function.dto' import { MAX_FUNCTION_COUNT } from 'src/constants' @ApiTags('Function') diff --git a/server/src/function/function.service.ts b/server/src/function/function.service.ts index 4dfdc4e7f9..c18c1fa27a 100644 --- a/server/src/function/function.service.ts +++ b/server/src/function/function.service.ts @@ -11,7 +11,7 @@ import { CreateFunctionDto } from './dto/create-function.dto' import { UpdateFunctionDto } from './dto/update-function.dto' import * as assert from 'node:assert' import { JwtService } from '@nestjs/jwt' -import { CompileFunctionDto } from './dto/compile-function.dto.ts' +import { CompileFunctionDto } from './dto/compile-function.dto' import { DatabaseService } from 'src/database/database.service' @Injectable() diff --git a/server/src/instance/instance.service.ts b/server/src/instance/instance.service.ts index 16a7112c78..50ad20380d 100644 --- a/server/src/instance/instance.service.ts +++ b/server/src/instance/instance.service.ts @@ -1,7 +1,7 @@ import { V1Deployment } from '@kubernetes/client-node' import { Injectable, Logger } from '@nestjs/common' import { GetApplicationNamespaceById } from '../utils/getter' -import { ResourceLabels } from '../constants' +import { MB, ResourceLabels } from '../constants' import { PrismaService } from '../prisma.service' import { StorageService } from '../storage/storage.service' import { DatabaseService } from 'src/database/database.service' @@ -56,6 +56,7 @@ export class InstanceService { const requestMemory = app.bundle.requestMemory const requestCpu = app.bundle.requestCPU const max_old_space_size = ~~(limitMemory * 0.8) + const max_http_header_size = 1 * MB const dependencies = app.configuration?.dependencies || [] const dependencies_string = dependencies.join(' ') @@ -82,7 +83,10 @@ export class InstanceService { value: app.region.storageConf.externalEndpoint, }, { name: 'OSS_REGION', value: app.region.name }, - { name: 'FLAGS', value: `--max_old_space_size=${max_old_space_size}` }, + { + name: 'FLAGS', + value: `--max_old_space_size=${max_old_space_size} --max-http-header-size=${max_http_header_size}`, + }, { name: 'DEPENDENCIES', value: dependencies_string }, ]