You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "spacewander (via GitHub)" <gi...@apache.org> on 2023/03/10 03:14:58 UTC

[GitHub] [apisix] spacewander commented on a diff in pull request #9028: fix: If allow_origins_by_regex is not nil, should be considered to allow_origins_by_regex only

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


##########
t/plugin/cors.t:
##########
@@ -927,3 +927,88 @@ Access-Control-Allow-Headers: headr1,headr2
 Access-Control-Expose-Headers: ex-headr1,ex-headr2
 Access-Control-Max-Age: 50
 Access-Control-Allow-Credentials: true
+
+
+
+=== TEST 36: set route ( regex specified and allow_origins is default value )

Review Comment:
   > When the test file is too large, for example > 800 lines, you should split it to a new file. Please take a look at t/plugin/limit-conn.t and t/plugin/limit-conn2.t.
   
   https://github.com/apache/apisix/blob/master/CONTRIBUTING.md#check-code-style-and-test-case-style



##########
apisix/plugins/cors.lua:
##########
@@ -297,13 +297,13 @@ end
 
 function _M.header_filter(conf, ctx)
     local req_origin =  ctx.original_request_origin
-    -- Try allow_origins first, if mismatched, try allow_origins_by_regex.
+    -- If allow_origins_by_regex is not nil, should be considered to allow_origins_by_regex only

Review Comment:
   Let's update docs for the new try order.



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org