Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions apps/cli/src/linter/specs/upstream.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,41 @@ describe('Upstream Linter', () => {
} as ADCSDK.Configuration,
expect: true,
},
{
name: 'should accept req_headers on active health check',
input: {
services: [
{
name: 'HealthCheck_RequestHeaders',
upstream: {
nodes: [
{
host: '1.1.1.1',
port: 443,
weight: 100,
},
],
checks: {
active: {
type: 'https',
http_path: '/',
req_headers: ['User-Agent: adc-health-check'],
healthy: {
interval: 2,
successes: 1,
},
unhealthy: {
interval: 1,
timeouts: 3,
},
},
},
},
},
],
} as ADCSDK.Configuration,
expect: true,
},
{
name: 'should only allow upstream mtls in client_cert and client_key',
input: {
Expand Down
2 changes: 1 addition & 1 deletion libs/backend-apisix-standalone/src/typing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const UpstreamSchema = z.strictObject({
port: z.coerce.number().int().min(1).max(65535).optional(),
http_path: z.string().default('/').optional(),
https_verify_certificate: z.boolean().default(true).optional(),
http_request_headers: z.array(z.string()).min(1).optional(),
req_headers: z.array(z.string()).min(1).optional(),
healthy: z
.strictObject({
...upstreamHealthCheckPassiveHealthy.shape,
Expand Down
2 changes: 1 addition & 1 deletion libs/sdk/src/core/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const upstreamSchema = (extend?: ZodRawShape) =>
port: portSchema.optional(),
http_path: z.string().default('/').optional(),
https_verify_certificate: z.boolean().default(true).optional(),
http_request_headers: z.array(z.string()).min(1).optional(),
req_headers: z.array(z.string()).min(1).optional(),
healthy: z
.strictObject({
...upstreamHealthCheckPassiveHealthy.shape,
Expand Down
4 changes: 2 additions & 2 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"default": true,
"type": "boolean"
},
"http_request_headers": {
"req_headers": {
"minItems": 1,
"type": "array",
"items": {
Expand Down Expand Up @@ -560,7 +560,7 @@
"default": true,
"type": "boolean"
},
"http_request_headers": {
"req_headers": {
"minItems": 1,
"type": "array",
"items": {
Expand Down