Skip to content

bug: cors plug-in problem #11965

@zhaomingcheng01

Description

@zhaomingcheng01

Current Behavior

The global cross-domain plug-in is enabled, but the request headers returned are inconsistent

===========================
C:\Users\Administrator>curl -iv http://10.129.45.55:9080/k8s-demo/actuator/health/liveness

  • Trying 10.129.45.55...
  • TCP_NODELAY set
  • Connected to 10.129.45.55 (10.129.45.55) port 9080 (#0)

GET /k8s-demo/actuator/health/liveness HTTP/1.1
Host: 10.129.45.55:9080
User-Agent: curl/7.55.1
Accept: /

< HTTP/1.1 200
HTTP/1.1 200
< Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Type: application/vnd.spring-boot.actuator.v3+json
< Content-Length: 15
Content-Length: 15
< Connection: keep-alive
Connection: keep-alive
< Date: Tue, 11 Feb 2025 10:04:57 GMT
Date: Tue, 11 Feb 2025 10:04:57 GMT
< Server: APISIX/3.2.1
Server: APISIX/3.2.1
< X-APISIX-Upstream-Status: 200
X-APISIX-Upstream-Status: 200
< Access-Control-Allow-Origin: *
Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: GET,POST,PUT,DELETE,PATCH,HEAD,OPTIONS,CONNECT,TRACE
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,PATCH,HEAD,OPTIONS,CONNECT,TRACE
< Access-Control-Max-Age: 600
Access-Control-Max-Age: 600
< Access-Control-Expose-Headers: **
Access-Control-Expose-Headers: **
< Access-Control-Allow-Credentials: true
Access-Control-Allow-Credentials: true

<
{"status":"UP"}* Connection #0 to host 10.129.45.55 left intact

C:\Users\Administrator>curl -iv http://10.129.45.55:9080/k8s-demo/actuator/health/liveness

  • Trying 10.129.45.55...
  • TCP_NODELAY set
  • Connected to 10.129.45.55 (10.129.45.55) port 9080 (#0)

GET /k8s-demo/actuator/health/liveness HTTP/1.1
Host: 10.129.45.55:9080
User-Agent: curl/7.55.1
Accept: /

< HTTP/1.1 200
HTTP/1.1 200
< Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Type: application/vnd.spring-boot.actuator.v3+json
< Content-Length: 15
Content-Length: 15
< Connection: keep-alive
Connection: keep-alive
< Date: Tue, 11 Feb 2025 10:04:58 GMT
Date: Tue, 11 Feb 2025 10:04:58 GMT
< Server: APISIX/3.2.1
Server: APISIX/3.2.1
< X-APISIX-Upstream-Status: 200
X-APISIX-Upstream-Status: 200

<
{"status":"UP"}* Connection #0 to host 10.129.45.55 left intact

< Access-Control-Allow-Origin: *
Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: GET,POST,PUT,DELETE,PATCH,HEAD,OPTIONS,CONNECT,TRACE
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,PATCH,HEAD,OPTIONS,CONNECT,TRACE
< Access-Control-Max-Age: 600
Access-Control-Max-Age: 600
< Access-Control-Expose-Headers: **
Access-Control-Expose-Headers: **
< Access-Control-Allow-Credentials: true
Access-Control-Allow-Credentials: true

Some request headers are occasionally lost

===========================
apiVersion: apisix.apache.org/v2
kind: ApisixGlobalRule
metadata:
name: global
namespace: apisix
spec:
plugins:
- config:
allow_credential: true
allow_headers: ''
allow_methods: '
'
allow_origins: ''
expose_headers: '
'
max_age: 600
enable: true
name: cors

Expected Behavior

No response

Error Logs

No response

Steps to Reproduce

Configure the global cross-domain plug-in

Environment

  • APISIX version (3.2.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions