spacewander commented on code in PR #7794:
URL: https://github.com/apache/apisix/pull/7794#discussion_r955938962


##########
apisix/plugins/response-rewrite.lua:
##########
@@ -27,13 +28,63 @@ local type        = type
 local pcall       = pcall
 
 
+local lrucache = core.lrucache.new({
+    type = "plugin",
+})
+
 local schema = {
     type = "object",
     properties = {
         headers = {
             description = "new headers for response",
-            type = "object",
-            minProperties = 1,
+            anyOf = {
+                {
+                    type = "object",
+                    minProperties = 1,
+                    patternProperties = {
+                        ["^[^:]+$"] = {
+                            oneOf = {
+                                {type = "string"},
+                                {type = "number"},
+                            }
+                        }
+                    },
+                },
+                {
+                    properties = {
+                        add = {
+                            type = "array",
+                            minItems = 1,
+                            items = {
+                                type = "string",
+                                -- "Set-Cookie: <cookie-name>=<cookie-value>; 
Max-Age=<number>"
+                                pattern = "^[^:]+:[^:]+[^/]$"
+                            }
+                        },
+                        set = {

Review Comment:
   For two reasons:
   1. the previous configuration works as `set` and it is an object too
   2. the `set` is unique - if two headers have the same name, only one is 
configured.



-- 
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