leandrocostam opened a new issue, #2190:
URL: https://github.com/apache/apisix-ingress-controller/issues/2190

   ### Current Behavior
   
   I am trying to add some headers using the response-rewrite plugin in 
APISIXRoute CRD, but I am facing an error in the APISIX controller.  The 
[current 
pattern](https://github.com/apache/apisix/blob/master/apisix/plugins/response-rewrite.lua#L63C44-L63C61)
 doesn't allow header value that contain multiples `:`. A common use case is 
when you have to add the `Content-Security-Policy` header with multiple domains 
using `https://`.
   
   ### Expected Behavior
   
   I should be able to define values for the headers using multiples `:`.
   
   ### Error Logs
   
   ApisixRoute Resource Events
   Source: ApisixIngress
   ```
   
   ApisixIngress synced failed, with error: 3 errors occurred: * plugin 
[response-rewrite] config is invalid * - headers: Must validate at least one 
schema (anyOf) * - headers.add.6: Does not match pattern '^[^:]+:[^:]+[^/]$'
   ```
   
   ### Steps to Reproduce
   
   1. Create the following APISIXRoute CRD resource in an existing Kubernetes 
cluster with the APISIX Ingress Controller installed:
   ```yaml
   apiVersion: apisix.apache.org/v2
   kind: ApisixRoute
   metadata:
     name: httpbin-route
   spec:
     http:
    - name: rule1
      match:
        hosts:
        - httpbin.org
        paths:
          - /*
      backends:
      - serviceName: foo
        servicePort: 8080
      plugins:
      - name: response-rewrite
        enable: true
        config:
          headers:
            add: 
              - "Content-Security-Policy: default-src 'self' 'unsafe-inline'; 
connect-src 'self' https://example.com; img-src 'self' data: blob:"
   ```
   2. Deploy the resource and check the events of the ApisixRoute CRD to see 
the error message.
   
   ### Environment
   
   - APISIX version: Apisix Ingress Controller 1.8.0
   - Operating system: GKE cluster running k8s 1.27
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to