[GitHub] [apisix-dashboard] LiteSun opened a new issue #821: Proposal: Monitor Routes
LiteSun opened a new issue #821: URL: https://github.com/apache/apisix-dashboard/issues/821 Please answer these questions before submitting your issue. - Why do you submit this issue? - [ ] Question or discussion - [ ] Bug - [ ] Requirements - [x] Feature or performance improvement - [ ] Other ___ ### Question - What do you want to know? ___ ### Bug - Which version of Apache APISIX Dashboard, OS, and Browser? - What happened? If possible, provide a way to reproduce the error. ___ ### Requirements or improvement - Please describe your requirements or improvement suggestions. TODO 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] LiteSun commented on issue #611: Proposal: Full lifecycle API management
LiteSun commented on issue #611: URL: https://github.com/apache/apisix-dashboard/issues/611#issuecomment-729502416 Additional feature to discuss: 1. Monitor Routes 2. Alarm Mechanism 3. Version management of route Technical details will be discussed in the corresponding proposal. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis commented on issue #2782: plugin(prometheus): incorrect http status name
membphis commented on issue #2782: URL: https://github.com/apache/apisix/issues/2782#issuecomment-729502291 @idbeta do you have time to confirm if this is a bug, many thx 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] membphis opened a new issue #2782: plugin(prometheus): incorrect http status name
membphis opened a new issue #2782: URL: https://github.com/apache/apisix/issues/2782 ![image](https://user-images.githubusercontent.com/6814606/99500783-ca03d400-29b5-11eb-8545-f541a9b9b7f8.png) 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] lilihongjava opened a new issue #2781: https plugins:curl: (60) Peer's certificate issuer has been marked as not trusted by the user.
lilihongjava opened a new issue #2781: URL: https://github.com/apache/apisix/issues/2781 ### Issue description Operation steps: 1. openssl genrsa -out private.pem 2048 2. openssl req -new -x509 -key private.pem -out cacert.pem -days 1095 3. cat /home/cert/cacert.pem >> /etc/pki/tls/certs/ca-bundle.crt 4. curl http://127.0.0.1:9080/apisix/admin/ssl/1 -H 'X-API-KEY: XXX' -X PUT -d '{XXX}‘ error image: ![image](https://user-images.githubusercontent.com/5799352/99497129-6f1bae00-29b0-11eb-9fd4-6254e9fec406.png) ### Environment * apisix version 1.5: * OS:CentOS Linux release 7.4.1708 (Core) 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] membphis commented on issue #782: 能否增加配置导入导出的功能,用于升级或多数据中心的apisix之间进行迁移
membphis commented on issue #782: URL: https://github.com/apache/apisix-dashboard/issues/782#issuecomment-729478555 This is the function we plan to do, and it is very useful for business users. Do you have any thoughts on this feature? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander edited a comment on issue #2779: doc: enable_websocket's location is not correct
spacewander edited a comment on issue #2779: URL: https://github.com/apache/apisix/issues/2779#issuecomment-729477284 See https://github.com/apache/apisix/pull/2691/files We already removed it from the doc. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on issue #2779: doc: enable_websocket's location is not correct
spacewander commented on issue #2779: URL: https://github.com/apache/apisix/issues/2779#issuecomment-729477284 See https://github.com/apache/apisix/pull/2691/files 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander opened a new pull request #2780: fix(http-logger): correct the Content-Type of newline format log report
spacewander opened a new pull request #2780: URL: https://github.com/apache/apisix/pull/2780 ### What this PR does / why we need it: ### Pre-submission checklist: * [ ] Did you explain what problem does this PR solve? Or what new features have been added? * [x] Have you added corresponding test cases? * [ ] Have you modified the corresponding document? * [x] Is this PR backward compatible? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] starsz opened a new issue #2779: doc: enable_websocket's location is not correct
starsz opened a new issue #2779: URL: https://github.com/apache/apisix/issues/2779 Hi. I found that `enable_websocket` had moved to the `upstream` location. So the doc https://github.com/apache/apisix/blob/master/doc/admin-api.md needs to update. Chinese document as well. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] membphis commented on issue #784: bug: when created route by adminAPI, "method" can be null value which dashboard can not identify
membphis commented on issue #784: URL: https://github.com/apache/apisix-dashboard/issues/784#issuecomment-729473561 for `method`, I think the Admin API's logic is fine. 1. no `method`: means any method. 2. has `method`: limit with listed method. It is the same as other fields, eg: `host`, `remote_addr` etc. ![image](https://user-images.githubusercontent.com/6814606/99495207-41813580-29ad-11eb-9496-407a25c84399.png) 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] nic-chen commented on issue #2110: request help: move `conf/cert` to `t/cert`
nic-chen commented on issue #2110: URL: https://github.com/apache/apisix/issues/2110#issuecomment-729466382 > And there is another problem. I'm not sure the usage and difference between `apisix_admin_ssl.crt` and `apisix.crt`, but currently `apisix_admin_ssl.crt` could be customized in > https://github.com/apache/apisix/blob/0ff2ab824264c1e55fafa489143e4cd68d7cc7bf/apisix/cli/ngx_tpl.lua#L236-L247 > > > but `apisix.crt` is hard-set to > https://github.com/apache/apisix/blob/0ff2ab824264c1e55fafa489143e4cd68d7cc7bf/apisix/cli/ngx_tpl.lua#L326-L327 > > Do we need to let users also customize `apisix.crt` yes, we should. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] nic-chen commented on issue #786: bug: when created route by adminAPI, "upstream" can not be modify by dashboard
nic-chen commented on issue #786: URL: https://github.com/apache/apisix-dashboard/issues/786#issuecomment-729464730 > @nic-chen please confirm that is a bug of Manager-API. if yes, we need to update the label updated 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander closed issue #2613: request help: If the fusing interval of apisix depends on the setttings of upstream.checks.active.healthy.interval
spacewander closed issue #2613: URL: https://github.com/apache/apisix/issues/2613 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on issue #2613: request help: If the fusing interval of apisix depends on the setttings of upstream.checks.active.healthy.interval
spacewander commented on issue #2613: URL: https://github.com/apache/apisix/issues/2613#issuecomment-729464561 Consider solved. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on issue #2171: bug: test case: route-domain-with-local-dns.t is unstable
spacewander commented on issue #2171: URL: https://github.com/apache/apisix/issues/2171#issuecomment-729464188 Should be solved now. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander closed issue #2171: bug: test case: route-domain-with-local-dns.t is unstable
spacewander closed issue #2171: URL: https://github.com/apache/apisix/issues/2171 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on issue #2379: missing doc for plugin `node-status`
spacewander commented on issue #2379: URL: https://github.com/apache/apisix/issues/2379#issuecomment-729463876 Solved. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander closed issue #2379: missing doc for plugin `node-status`
spacewander closed issue #2379: URL: https://github.com/apache/apisix/issues/2379 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander closed issue #2640: [DISCUSS] Only keep one Server header in HTTP response
spacewander closed issue #2640: URL: https://github.com/apache/apisix/issues/2640 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on issue #2640: [DISCUSS] Only keep one Server header in HTTP response
spacewander commented on issue #2640: URL: https://github.com/apache/apisix/issues/2640#issuecomment-729463518 Solved. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] idbeta edited a comment on issue #786: bug: when created route by adminAPI, "upstream" can not be modify by dashboard
idbeta edited a comment on issue #786: URL: https://github.com/apache/apisix-dashboard/issues/786#issuecomment-729456399 @juzhiyuan there two apis in this case click edit ``` Request URL: http://127.0.0.1:8080/apisix/admin/routes/1 {"code":0,"message":"","data":{"id":"1","create_time":0,"update_time":0,"uri":"/name","name":"test_route","methods":["GET","POST"],"upstream":{"nodes":{"127.0.0.1:9797":1},"type":"roundrobin","hash_on":"vars","pass_host":"pass"}},"request_id":"dd826fd2-5739-4f56-88a4-7659892a38c8"} ``` click next to upstream ``` Request URL: http://127.0.0.1:8080/apisix/admin/upstreams {"code":0,"message":"","data":{"rows":[],"total_size":0},"request_id":"e0f6114b-68a4-4019-968f-54dc30f5f678"} ``` 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] idbeta edited a comment on issue #786: bug: when created route by adminAPI, "upstream" can not be modify by dashboard
idbeta edited a comment on issue #786: URL: https://github.com/apache/apisix-dashboard/issues/786#issuecomment-729456399 @juzhiyuan there two api in this case click edit ``` Request URL: http://127.0.0.1:8080/apisix/admin/routes/1 {"code":0,"message":"","data":{"id":"1","create_time":0,"update_time":0,"uri":"/name","name":"test_route","methods":["GET","POST"],"upstream":{"nodes":{"127.0.0.1:9797":1},"type":"roundrobin","hash_on":"vars","pass_host":"pass"}},"request_id":"dd826fd2-5739-4f56-88a4-7659892a38c8"} ``` click next to upstream ``` Request URL: http://127.0.0.1:8080/apisix/admin/upstreams {"code":0,"message":"","data":{"rows":[],"total_size":0},"request_id":"e0f6114b-68a4-4019-968f-54dc30f5f678"} ``` 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] idbeta edited a comment on issue #786: bug: when created route by adminAPI, "upstream" can not be modify by dashboard
idbeta edited a comment on issue #786: URL: https://github.com/apache/apisix-dashboard/issues/786#issuecomment-729456399 @juzhiyuan there two api in this case click edit ``` http://127.0.0.1:8080/apisix/admin/routes/1 {"code":0,"message":"","data":{"id":"1","create_time":0,"update_time":0,"uri":"/name","name":"test_route","methods":["GET","POST"],"upstream":{"nodes":{"127.0.0.1:9797":1},"type":"roundrobin","hash_on":"vars","pass_host":"pass"}},"request_id":"dd826fd2-5739-4f56-88a4-7659892a38c8"} ``` click next to upstream ``` Request URL: http://127.0.0.1:8080/apisix/admin/upstreams {"code":0,"message":"","data":{"rows":[],"total_size":0},"request_id":"e0f6114b-68a4-4019-968f-54dc30f5f678"} ``` 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] idbeta edited a comment on issue #786: bug: when created route by adminAPI, "upstream" can not be modify by dashboard
idbeta edited a comment on issue #786: URL: https://github.com/apache/apisix-dashboard/issues/786#issuecomment-729456399 @juzhiyuan ``` Request URL: http://127.0.0.1:8080/apisix/admin/upstreams {"code":0,"message":"","data":{"rows":[],"total_size":0},"request_id":"e0f6114b-68a4-4019-968f-54dc30f5f678"} ``` ``` http://127.0.0.1:8080/apisix/admin/routes/1 {"code":0,"message":"","data":{"id":"1","create_time":0,"update_time":0,"uri":"/name","name":"test_route","methods":["GET","POST"],"upstream":{"nodes":{"127.0.0.1:9797":1},"type":"roundrobin","hash_on":"vars","pass_host":"pass"}},"request_id":"dd826fd2-5739-4f56-88a4-7659892a38c8"} ``` 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] idbeta edited a comment on issue #786: bug: when created route by adminAPI, "upstream" can not be modify by dashboard
idbeta edited a comment on issue #786: URL: https://github.com/apache/apisix-dashboard/issues/786#issuecomment-729456399 @juzhiyuan ``` Request URL: http://127.0.0.1:8080/apisix/admin/upstreams ``` ``` {"code":0,"message":"","data":{"rows":[],"total_size":0},"request_id":"e0f6114b-68a4-4019-968f-54dc30f5f678"} ``` 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] idbeta commented on issue #786: bug: when created route by adminAPI, "upstream" can not be modify by dashboard
idbeta commented on issue #786: URL: https://github.com/apache/apisix-dashboard/issues/786#issuecomment-729456399 @juzhiyuan ``` Request URL: http://127.0.0.1:8080/apisix/admin/upstreams ``` ``` {"code":0,"message":"","data":{"rows":[{"id":"foobar","create_time":0,"update_time":0,"nodes":{"127.0.0.1:9797":1},"type":"roundrobin","hash_on":"vars","pass_host":"pass"}],"total_size":1},"request_id":"da585937-4b75-4af0-b465-a95ac0e108df"} ``` 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] odidev commented on issue #1887: Linux jobs in Travis-CI
odidev commented on issue #1887: URL: https://github.com/apache/apisix/issues/1887#issuecomment-729454764 @moonming I am currently not looking into this activity as this project is moved to Github-actions. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] idbeta commented on issue #786: bug: when created route by adminAPI, "upstream" can not be modify by dashboard
idbeta commented on issue #786: URL: https://github.com/apache/apisix-dashboard/issues/786#issuecomment-729454603 > I mean could @idbeta please check and paste the response from that page here? > > [#786 (comment)](https://github.com/apache/apisix-dashboard/issues/786#issuecomment-725315724) this is valid for the frontend. sorry, I am late, I will check this today 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] gy09535 commented on a change in pull request #2727: feat: Improve zipkin span reporter performance
gy09535 commented on a change in pull request #2727: URL: https://github.com/apache/apisix/pull/2727#discussion_r525832876 ## File path: apisix/plugins/zipkin/reporter.lua ## @@ -105,38 +104,68 @@ function _M.report(self, span) annotations = span.logs } -local i = self.pending_spans_n + 1 -self.pending_spans[i] = zipkin_span -self.pending_spans_n = i -end - -function _M.flush(self) -if self.pending_spans_n == 0 then - -return true +self.pending_spans_n = self.pending_spans_n + 1 +if self.processor then +self.processor:push(zipkin_span) end +end -local pending_spans = cjson.encode(self.pending_spans) -self.pending_spans = {} -self.pending_spans_n = 0 - +local function send_span(pending_spans, report) local httpc = resty_http.new() -local res, err = httpc:request_uri(self.endpoint, { +local res = httpc:request_uri(report.endpoint, { method = "POST", headers = { ["content-type"] = "application/json", }, body = pending_spans, +keepalive = 5000, +keepalive_pool = 5 }) --- TODO: on failure, retry? if not res then -return nil, "failed to request: " .. err +return nil, "failed: " .. report.endpoint elseif res.status < 200 or res.status >= 300 then return nil, "failed: " .. res.status .. " " .. res.reason end -return true + return true +end + +function _M.init_processor(self) +local process_conf = { +name = "zipkin_report", +retry_delay = 1, +batch_max_size = 1000, +max_retry_count = 0, +buffer_duration = 60, +inactive_timeout = 5 +} + +local flush = function (entries, batch_max_size) +if not entries then +return true +end + +local pending_spans, err +if batch_max_size == 1 then +pending_spans, err = cjson.encode(entries[1]) Review comment: I think it doesn't matter in this case, it is a batch job and can not be has error, because for input spans must be serialized.If it can not be serialized, must be a bug? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] gy09535 edited a comment on pull request #2727: feat: Improve zipkin span reporter performance
gy09535 edited a comment on pull request #2727: URL: https://github.com/apache/apisix/pull/2727#issuecomment-729452331 For code style should we have some tools such vs code format config? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] gy09535 commented on pull request #2727: feat: Improve zipkin span reporter performance
gy09535 commented on pull request #2727: URL: https://github.com/apache/apisix/pull/2727#issuecomment-729452331 For code style should we has some tools such vs code format config? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] gy09535 commented on pull request #2177: feat: Support plugin for "aliyun" log service
gy09535 commented on pull request #2177: URL: https://github.com/apache/apisix/pull/2177#issuecomment-729451324 Please review CC @moonming 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] gy09535 commented on a change in pull request #2727: feat: Improve zipkin span reporter performance
gy09535 commented on a change in pull request #2727: URL: https://github.com/apache/apisix/pull/2727#discussion_r525832876 ## File path: apisix/plugins/zipkin/reporter.lua ## @@ -105,38 +104,68 @@ function _M.report(self, span) annotations = span.logs } -local i = self.pending_spans_n + 1 -self.pending_spans[i] = zipkin_span -self.pending_spans_n = i -end - -function _M.flush(self) -if self.pending_spans_n == 0 then - -return true +self.pending_spans_n = self.pending_spans_n + 1 +if self.processor then +self.processor:push(zipkin_span) end +end -local pending_spans = cjson.encode(self.pending_spans) -self.pending_spans = {} -self.pending_spans_n = 0 - +local function send_span(pending_spans, report) local httpc = resty_http.new() -local res, err = httpc:request_uri(self.endpoint, { +local res = httpc:request_uri(report.endpoint, { method = "POST", headers = { ["content-type"] = "application/json", }, body = pending_spans, +keepalive = 5000, +keepalive_pool = 5 }) --- TODO: on failure, retry? if not res then -return nil, "failed to request: " .. err +return nil, "failed: " .. report.endpoint elseif res.status < 200 or res.status >= 300 then return nil, "failed: " .. res.status .. " " .. res.reason end -return true + return true +end + +function _M.init_processor(self) +local process_conf = { +name = "zipkin_report", +retry_delay = 1, +batch_max_size = 1000, +max_retry_count = 0, +buffer_duration = 60, +inactive_timeout = 5 +} + +local flush = function (entries, batch_max_size) +if not entries then +return true +end + +local pending_spans, err +if batch_max_size == 1 then +pending_spans, err = cjson.encode(entries[1]) Review comment: I think it doesn't matter in this case, it is a batch job and can not be has error, because for input spans must be serialized.If it can not be serialized, must be bug? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] gy09535 commented on a change in pull request #2727: feat: Improve zipkin span reporter performance
gy09535 commented on a change in pull request #2727: URL: https://github.com/apache/apisix/pull/2727#discussion_r525832876 ## File path: apisix/plugins/zipkin/reporter.lua ## @@ -105,38 +104,68 @@ function _M.report(self, span) annotations = span.logs } -local i = self.pending_spans_n + 1 -self.pending_spans[i] = zipkin_span -self.pending_spans_n = i -end - -function _M.flush(self) -if self.pending_spans_n == 0 then - -return true +self.pending_spans_n = self.pending_spans_n + 1 +if self.processor then +self.processor:push(zipkin_span) end +end -local pending_spans = cjson.encode(self.pending_spans) -self.pending_spans = {} -self.pending_spans_n = 0 - +local function send_span(pending_spans, report) local httpc = resty_http.new() -local res, err = httpc:request_uri(self.endpoint, { +local res = httpc:request_uri(report.endpoint, { method = "POST", headers = { ["content-type"] = "application/json", }, body = pending_spans, +keepalive = 5000, +keepalive_pool = 5 }) --- TODO: on failure, retry? if not res then -return nil, "failed to request: " .. err +return nil, "failed: " .. report.endpoint elseif res.status < 200 or res.status >= 300 then return nil, "failed: " .. res.status .. " " .. res.reason end -return true + return true +end + +function _M.init_processor(self) +local process_conf = { +name = "zipkin_report", +retry_delay = 1, +batch_max_size = 1000, +max_retry_count = 0, +buffer_duration = 60, +inactive_timeout = 5 +} + +local flush = function (entries, batch_max_size) +if not entries then +return true +end + +local pending_spans, err +if batch_max_size == 1 then +pending_spans, err = cjson.encode(entries[1]) Review comment: I think it doesn't matter in this case, it is a batch job and can not be has error, because for input spans must be serialized. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] membphis commented on issue #786: bug: when created route by adminAPI, "upstream" can not be modify by dashboard
membphis commented on issue #786: URL: https://github.com/apache/apisix-dashboard/issues/786#issuecomment-729448689 @nic-chen please confirm that is a bug of Manager-API. if yes, we need to update the label 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Applenice commented on issue #2777: request help: How to close X-Forwarded* and X-Real-IP in requests
Applenice commented on issue #2777: URL: https://github.com/apache/apisix/issues/2777#issuecomment-729448487 > @Applenice Could you introduce your demands why these headers shouldn't be passed? I think it should be configurable, and not all upstream need or care about this information. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] moonming commented on issue #820: [DRAFT] Support global plugin
moonming commented on issue #820: URL: https://github.com/apache/apisix-dashboard/issues/820#issuecomment-729447848 We need to list the plug-in as an object separately, at this time etcd may not be convenient to use directly 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan opened a new issue #820: [DRAFT] Support global plugin
juzhiyuan opened a new issue #820: URL: https://github.com/apache/apisix-dashboard/issues/820 This proposal will be resolved in 2.1, and development will be done in 2.2. *TODO* 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Miss-you commented on issue #2703: response-rewrite rewrite the response from apisix
Miss-you commented on issue #2703: URL: https://github.com/apache/apisix/issues/2703#issuecomment-729437502 done https://github.com/apache/apisix/issues/2721 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Miss-you closed issue #2703: response-rewrite rewrite the response from apisix
Miss-you closed issue #2703: URL: https://github.com/apache/apisix/issues/2703 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander closed issue #2714: bug: When accessing APISIX route, there are two servers in the response header.
spacewander closed issue #2714: URL: https://github.com/apache/apisix/issues/2714 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander merged pull request #2731: fix: remove upstream 'Server' header info. fix #2714
spacewander merged pull request #2731: URL: https://github.com/apache/apisix/pull/2731 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[apisix] branch master updated: fix: remove upstream 'Server' header info. fix #2714 (#2731)
This is an automated email from the ASF dual-hosted git repository. spacewander pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 53e2d53 fix: remove upstream 'Server' header info. fix #2714 (#2731) 53e2d53 is described below commit 53e2d5387f86d7b36673e75eba6bc58f3a59fb7d Author: Yousa AuthorDate: Wed Nov 18 13:15:31 2020 +0800 fix: remove upstream 'Server' header info. fix #2714 (#2731) fix #2714 --- apisix/cli/ngx_tpl.lua | 1 - apisix/init.lua| 4 ++-- t/APISIX.pm| 1 - t/core/utils.t | 1 - t/node/remote-addr-ipv6.t | 1 - t/plugin/redirect.t| 1 - t/router/multi-ssl-certs.t | 1 - t/router/radixtree-sni.t | 3 --- 8 files changed, 2 insertions(+), 11 deletions(-) diff --git a/apisix/cli/ngx_tpl.lua b/apisix/cli/ngx_tpl.lua index d66b84e..0af266d 100644 --- a/apisix/cli/ngx_tpl.lua +++ b/apisix/cli/ngx_tpl.lua @@ -403,7 +403,6 @@ http { proxy_set_header Upgrade $upstream_upgrade; proxy_set_header Connection$upstream_connection; proxy_set_header X-Real-IP $remote_addr; -proxy_pass_header Server; proxy_pass_header Date; ### the following x-forwarded-* headers is to send to upstream server diff --git a/apisix/init.lua b/apisix/init.lua index b591e36..629e750 100644 --- a/apisix/init.lua +++ b/apisix/init.lua @@ -338,8 +338,6 @@ function _M.http_access_phase() core.ctx.set_vars_meta(api_ctx) -core.response.set_header("Server", ver_header) - -- load and run global rule if router.global_rules and router.global_rules.values and #router.global_rules.values > 0 then @@ -629,6 +627,8 @@ end function _M.http_header_filter_phase() +core.response.set_header("Server", ver_header) + common_phase("header_filter") end diff --git a/t/APISIX.pm b/t/APISIX.pm index 43de420..ca47f3b 100644 --- a/t/APISIX.pm +++ b/t/APISIX.pm @@ -399,7 +399,6 @@ _EOC_ proxy_set_header Upgrade \$upstream_upgrade; proxy_set_header Connection\$upstream_connection; proxy_set_header X-Real-IP \$remote_addr; -proxy_pass_header Server; proxy_pass_header Date; proxy_pass \$upstream_scheme://apisix_backend\$upstream_uri; mirror /proxy_mirror; diff --git a/t/core/utils.t b/t/core/utils.t index 6fb4240..402ae4e 100644 --- a/t/core/utils.t +++ b/t/core/utils.t @@ -195,7 +195,6 @@ received: Content-Type: text/plain received: Content-Length: 12 received: Connection: close received: Server: APISIX -received: Server: openresty received: \nreceived: hello world close: 1 nil} --- no_error_log diff --git a/t/node/remote-addr-ipv6.t b/t/node/remote-addr-ipv6.t index 9861275..2e610fe 100644 --- a/t/node/remote-addr-ipv6.t +++ b/t/node/remote-addr-ipv6.t @@ -116,7 +116,6 @@ received: Content-Type: text/plain received: Content-Length: 12 received: Connection: close received: Server: APISIX/\d\.\d+(\.\d+)? -received: Server: \w+ received: received: hello world failed to receive a line: closed \[\] diff --git a/t/plugin/redirect.t b/t/plugin/redirect.t index 45dcb1e..daee190 100644 --- a/t/plugin/redirect.t +++ b/t/plugin/redirect.t @@ -671,7 +671,6 @@ received: Content-Type: text/plain received: Content-Length: 12 received: Connection: close received: Server: APISIX/\d\.\d+(\.\d+)? -received: Server: \w+ received: \nreceived: hello world close: 1 nil} --- no_error_log diff --git a/t/router/multi-ssl-certs.t b/t/router/multi-ssl-certs.t index 6990ad9..ea092aa 100644 --- a/t/router/multi-ssl-certs.t +++ b/t/router/multi-ssl-certs.t @@ -162,7 +162,6 @@ received: Content-Type: text/plain received: Content-Length: 12 received: Connection: close received: Server: APISIX/\d\.\d+(\.\d+)? -received: Server: \w+ received: \nreceived: hello world close: 1 nil} --- error_log diff --git a/t/router/radixtree-sni.t b/t/router/radixtree-sni.t index 88d3da6..532fdea 100644 --- a/t/router/radixtree-sni.t +++ b/t/router/radixtree-sni.t @@ -162,7 +162,6 @@ received: Content-Type: text/plain received: Content-Length: 12 received: Connection: close received: Server: APISIX/\d\.\d+(\.\d+)? -received: Server: \w+ received: \nreceived: hello world close: 1 nil} --- error_log @@ -317,7 +316,6 @@ received: Content-Type: text/plain received: Content-Length: 12 received: Connection: close received: Server: APISIX/\d\.\d+(\.\d+)? -received: Server: \w+ received: \nreceived: hello world close: 1 nil} --- error_log @@ -432,7 +430,6 @@ received: Content-Type: text/plain received: Content-Length: 12 received: Connection: close received: Server: APISIX/\d\.\d+(\.\d+)? -received: Server: \w+ received: \nreceived: hello world close: 1 nil} --- error_log
[GitHub] [apisix-dashboard] nic-chen commented on issue #605: discuss: how to get different type of plugin schema in 2.0 manager-api
nic-chen commented on issue #605: URL: https://github.com/apache/apisix-dashboard/issues/605#issuecomment-729405247 > @nic-chen do we will implement this feature in milestone `2.2`? sure 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Miss-you closed issue #2721: request help: response-rewrite plug-in document optimization
Miss-you closed issue #2721: URL: https://github.com/apache/apisix/issues/2721 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Miss-you merged pull request #2732: docs: add Attention message for 'response-rewrite' doc.
Miss-you merged pull request #2732: URL: https://github.com/apache/apisix/pull/2732 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[apisix] branch master updated: docs: add Attention message for 'response-rewrite' doc. (#2732)
This is an automated email from the ASF dual-hosted git repository. yousa pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new ec5ba5f docs: add Attention message for 'response-rewrite' doc. (#2732) ec5ba5f is described below commit ec5ba5f68cf8ab48f41ae588a1ec7440c7f8812e Author: Yousa AuthorDate: Wed Nov 18 12:51:12 2020 +0800 docs: add Attention message for 'response-rewrite' doc. (#2732) * 1. add Summary for 'zh-cn/plugins/response-rewrite.md' 2. add Attention message for 'response-rewrite' doc. * fix typo * response rewrite plugin, rewrite the content from upstream. -> response rewrite plugin, rewrite the content returned by the upstream as well as Apache APISIX itself. --- doc/plugins/response-rewrite.md | 11 - doc/zh-cn/plugins/response-rewrite.md | 43 +++ 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/doc/plugins/response-rewrite.md b/doc/plugins/response-rewrite.md index 60eb093..cb8ccf8 100644 --- a/doc/plugins/response-rewrite.md +++ b/doc/plugins/response-rewrite.md @@ -26,10 +26,11 @@ - [**How To Enable**](#how-to-enable) - [**Test Plugin**](#test-plugin) - [**Disable Plugin**](#disable-plugin) +- [**Attention**](#Attention) ## Name -response rewrite plugin, rewrite the content from upstream. +response rewrite plugin, rewrite the content returned by the upstream as well as Apache APISIX itself. **senario**: @@ -116,3 +117,11 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f1 ``` The `response rewrite` plugin has been disabled now. It works for other plugins. + +## Attention + +`ngx.exit` will interrupt the execution of the current request and return status code to Nginx. + +![](https://cdn.jsdelivr.net/gh/Miss-you/img/picgo/20201113010623.png) + +However, if you execute `ngx.exit` during the access phase, it only interrupts the request processing phase, and the response phase will still process it, i.e. if you configure the `response-rewrite` plugin, it will force overwriting of your response information (e.g. response status code). diff --git a/doc/zh-cn/plugins/response-rewrite.md b/doc/zh-cn/plugins/response-rewrite.md index 40c259f..cad0a8f 100644 --- a/doc/zh-cn/plugins/response-rewrite.md +++ b/doc/zh-cn/plugins/response-rewrite.md @@ -19,12 +19,21 @@ - [English](../../plugins/response-rewrite.md) -# response-rewrite +# 目录 -该插件支持修改上游服务返回的 body 和 header 信息。 +- [**response-rewrite**](#response-rewrite) +- [**配置参数**](#配置参数) +- [**开启插件**](#开启插件) +- [**测试插件**](#测试插件) +- [**禁用插件**](#禁用插件) +- [**注意事项**](#注意事项) + +## response-rewrite + +该插件支持修改上游服务或网关本身返回的 body 和 header 信息。 使用场景: -1、可以设置 `Access-Control-Allow-*` 等 header 信息,来实现 CORS (跨域资源共享)的功能。 +1、可以设置 `Access-Control-Allow-*` 等 header 信息,来实现 CORS (跨域资源共享)的功能。 2、另外也可以通过配置 status_code 和 header 里面的 Location 来实现重定向,当然如果只是需要重定向功能,最好使用 [redirect](redirect.md) 插件。 ## 配置参数 @@ -40,7 +49,7 @@ ### 开启插件 -下面是一个示例,在指定的 route 上开启了 `response rewrite` 插件: +下面是一个示例,在指定的 route 上开启了 `response rewrite` 插件: ```shell curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' @@ -85,3 +94,29 @@ X-Server-status: on {"code":"ok","message":"new json body"} ``` + +### 禁用插件 + +禁用`response-rewrite`插件很简单。你不需要重新启动服务,只需要在插件配置中删除相应的 json 配置,它将立即生效。 + +```shell +curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' +{ +"methods": ["GET"], +"uri": "/test/index.html", +"upstream": { +"type": "roundrobin", +"nodes": { +"127.0.0.1:80": 1 +} +} +}' +``` + +## 注意事项 + +`ngx.exit`将中断当前请求的执行,并返回状态码给 Nginx。 + +![](https://cdn.jsdelivr.net/gh/Miss-you/img/picgo/20201113010623.png) + +但是很多人可能会对`ngx.exit`理解出现偏差,即如果你在`access`阶段执行`ngx.exit`,只是中断了请求处理阶段,响应阶段仍然会处理。比如,如果你配置了`response-rewrite`插件,它会强制覆盖你的响应信息(如响应代码)。
[GitHub] [apisix] Yiyiyimu commented on a change in pull request #2685: refactor: moved etcd initialiation to apisix/cli/etcd.lua
Yiyiyimu commented on a change in pull request #2685: URL: https://github.com/apache/apisix/pull/2685#discussion_r525773360 ## File path: apisix/cli/etcd.lua ## @@ -0,0 +1,205 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +local base64_encode = require("base64").encode +local dkjson = require("dkjson") +local util = require("apisix.cli.util") +local file = require("apisix.cli.file") + +local type = type +local ipairs = ipairs +local print = print +local tonumber = tonumber +local str_format = string.format + +local _M = {} + + +local function parse_semantic_version(ver) +local errmsg = "invalid semantic version: " .. ver + +local parts = util.split(ver, "-") +if #parts > 2 then +return nil, errmsg +end + +if #parts == 2 then +ver = parts[1] +end + +local fields = util.split(ver, ".") +if #fields ~= 3 then +return nil, errmsg +end + +local major = tonumber(fields[1]) +local minor = tonumber(fields[2]) +local patch = tonumber(fields[3]) + +if not (major and minor and patch) then +return nil, errmsg +end + +return { +major = major, +minor = minor, +patch = patch, +} +end + + +local function compare_semantic_version(v1, v2) +local ver1, err = parse_semantic_version(v1) +if not ver1 then +return nil, err +end + +local ver2, err = parse_semantic_version(v2) +if not ver2 then +return nil, err +end + +if ver1.major ~= ver2.major then +return ver1.major < ver2.major +end + +if ver1.minor ~= ver2.minor then +return ver1.minor < ver2.minor +end + +return ver1.patch < ver2.patch +end + + +function _M.init(env, show_output) +-- read_yaml_conf +local yaml_conf, err = file.read_yaml_conf(env.apisix_home) +if not yaml_conf then +util.die("failed to read local yaml config of apisix: ", err) +end + +if not yaml_conf.apisix then +util.die("failed to read `apisix` field from yaml file when init etcd") +end + +if yaml_conf.apisix.config_center ~= "etcd" then +return true +end + +if not yaml_conf.etcd then +util.die("failed to read `etcd` field from yaml file when init etcd") +end + +local etcd_conf = yaml_conf.etcd + +local timeout = etcd_conf.timeout or 3 +local uri + +-- convert old single etcd config to multiple etcd config +if type(yaml_conf.etcd.host) == "string" then +yaml_conf.etcd.host = {yaml_conf.etcd.host} +end + +local host_count = #(yaml_conf.etcd.host) +local scheme +for i = 1, host_count do +local host = yaml_conf.etcd.host[i] +local fields = util.split(host, "://") +if not fields then +util.die("malformed etcd endpoint: ", host, "\n") +end + +if not scheme then +scheme = fields[1] +elseif scheme ~= fields[1] then +print([[WARNING: mixed protocols among etcd endpoints]]) +end +end + +-- check the etcd cluster version +for index, host in ipairs(yaml_conf.etcd.host) do +uri = host .. "/version" +local cmd = str_format("curl -s -m %d %s", timeout * 2, uri) +local res = util.execute_cmd(cmd) +local errmsg = str_format("got malformed version message: \"%s\" from etcd\n", + res) + +local body, _, err = dkjson.decode(res) +if err then +util.die(errmsg) +end + +local cluster_version = body["etcdcluster"] +if not cluster_version then +util.die(errmsg) +end + +if compare_semantic_version(cluster_version, env.min_etcd_version) then +util.die("etcd cluster version ", cluster_version, + " is less than the required version ", + env.min_etcd_version, + ", please upgrade your etcd cluster\n") +end +end + +local etcd_ok = false +for index, host in ipairs(yaml_conf.etcd.host) do +local is_success = true + +for _, dir_name in ipairs({"/routes", "/upstreams", "/services", +
[GitHub] [apisix] gewei2000 closed issue #2775: request help: alwayls failed to fetch data from etcd
gewei2000 closed issue #2775: URL: https://github.com/apache/apisix/issues/2775 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on a change in pull request #2727: feat: Improve zipkin span reporter performance
spacewander commented on a change in pull request #2727: URL: https://github.com/apache/apisix/pull/2727#discussion_r525757548 ## File path: apisix/plugins/zipkin/reporter.lua ## @@ -105,38 +104,68 @@ function _M.report(self, span) annotations = span.logs } -local i = self.pending_spans_n + 1 -self.pending_spans[i] = zipkin_span -self.pending_spans_n = i -end - -function _M.flush(self) -if self.pending_spans_n == 0 then - -return true +self.pending_spans_n = self.pending_spans_n + 1 +if self.processor then +self.processor:push(zipkin_span) end +end -local pending_spans = cjson.encode(self.pending_spans) -self.pending_spans = {} -self.pending_spans_n = 0 - +local function send_span(pending_spans, report) local httpc = resty_http.new() -local res, err = httpc:request_uri(self.endpoint, { +local res = httpc:request_uri(report.endpoint, { method = "POST", headers = { ["content-type"] = "application/json", }, body = pending_spans, +keepalive = 5000, +keepalive_pool = 5 }) --- TODO: on failure, retry? if not res then -return nil, "failed to request: " .. err +return nil, "failed: " .. report.endpoint elseif res.status < 200 or res.status >= 300 then return nil, "failed: " .. res.status .. " " .. res.reason end -return true + return true +end + +function _M.init_processor(self) +local process_conf = { +name = "zipkin_report", +retry_delay = 1, +batch_max_size = 1000, +max_retry_count = 0, +buffer_duration = 60, +inactive_timeout = 5 +} + +local flush = function (entries, batch_max_size) +if not entries then +return true +end + +local pending_spans, err +if batch_max_size == 1 then +pending_spans, err = cjson.encode(entries[1]) Review comment: @moonming @gy09535 I suddenly realized one thing: since `core.json` use `cjson` inside, when we set `encode_number_precision(16)`, we already do the same thing for `cjson`. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers commented on a change in pull request #2685: refactor: moved etcd initialiation to apisix/cli/etcd.lua
tokers commented on a change in pull request #2685: URL: https://github.com/apache/apisix/pull/2685#discussion_r525755333 ## File path: apisix/cli/file.lua ## @@ -0,0 +1,146 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +local yaml = require("tinyyaml") +local profile = require("apisix.core.profile") +local util = require("apisix.cli.util") + +local pairs = pairs +local type = type +local tonumber = tonumber +local getenv = os.getenv +local str_gmatch = string.gmatch +local str_find = string.find + +local _M = {} + + +local function is_empty_yaml_line(line) +return line == '' or str_find(line, '^%s*$') or str_find(line, '^%s*#') +end + + +local function tab_is_array(t) +local count = 0 +for k,v in pairs(t) do +count = count + 1 +end + +return #t == count +end + + +local function resolve_conf_var(conf) +for key, val in pairs(conf) do +if type(val) == "table" then +resolve_conf_var(val) +elseif type(val) == "string" then +local var_used = false +-- we use '${{var}}' because '$var' and '${var}' are taken +-- by Nginx +local new_val = val:gsub("%$%{%{([%w_]+)%}%}", function(var) +local v = getenv(var) +if v then +var_used = true +return v +end + +util.die("failed to handle configuration: ", + "can't find environment variable ", + var, "\n") +end) + +if var_used then +if tonumber(new_val) ~= nil then +new_val = tonumber(new_val) +elseif new_val == "true" then +new_val = true +elseif new_val == "false" then +new_val = false +end +end + +conf[key] = new_val +end +end +end + + +local function merge_conf(base, new_tab) +for key, val in pairs(new_tab) do +if type(val) == "table" then +if tab_is_array(val) then +base[key] = val +elseif base[key] == nil then +base[key] = val +else +merge_conf(base[key], val) +end + +else +base[key] = val +end +end + +return base +end + + +function _M.read_yaml_conf(apisix_home) +profile.apisix_home = apisix_home .. "/" +local local_conf_path = profile:yaml_path("config-default") +local default_conf_yaml, err = util.read_file(local_conf_path) +if not default_conf_yaml then +return nil, err +end + +local default_conf = yaml.parse(default_conf_yaml) +if not default_conf then +return nil, "invalid config-default.yaml file" +end + +local_conf_path = profile:yaml_path("config") +local user_conf_yaml, err = util.read_file(local_conf_path) +if not user_conf_yaml then +return nil, err +end + +local is_empty_file = true +for line in str_gmatch(user_conf_yaml .. '\n', '(.-)\r?\n') do +if not is_empty_yaml_line(line) then +is_empty_file = false +break +end +end + +if not is_empty_file then +local user_conf = yaml.parse(user_conf_yaml) +if not user_conf then +return nil, "invalid config.yaml file" +end + +resolve_conf_var(user_conf) +merge_conf(default_conf, user_conf) +end + +return default_conf +end + + +return _M + Review comment: @spacewander Fixed. ## File path: apisix/cli/util.lua ## @@ -46,4 +50,36 @@ function _M.trim(s) end +function _M.split(self, sep) +local sep, fields = sep or ":", {} +local pattern = str_format("([^%s]+)", sep) + +self:gsub(pattern, function(c) fields[#fields + 1] = c end) + +return fields +end + + +function _M.read_file(file_path) +local file, err = open(file_path, "rb") +if not file then +return false, "failed to open file: " .. file_path .. ", error info:" .. err +end + +local data, err = file:read("*all") +if err ~= nil then Review comment:
[GitHub] [apisix] tokers commented on a change in pull request #2685: refactor: moved etcd initialiation to apisix/cli/etcd.lua
tokers commented on a change in pull request #2685: URL: https://github.com/apache/apisix/pull/2685#discussion_r525753976 ## File path: apisix/cli/etcd.lua ## @@ -0,0 +1,205 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +local base64_encode = require("base64").encode +local dkjson = require("dkjson") +local util = require("apisix.cli.util") +local file = require("apisix.cli.file") + +local type = type +local ipairs = ipairs +local print = print +local tonumber = tonumber +local str_format = string.format + +local _M = {} + + +local function parse_semantic_version(ver) +local errmsg = "invalid semantic version: " .. ver + +local parts = util.split(ver, "-") +if #parts > 2 then +return nil, errmsg +end + +if #parts == 2 then +ver = parts[1] +end + +local fields = util.split(ver, ".") +if #fields ~= 3 then +return nil, errmsg +end + +local major = tonumber(fields[1]) +local minor = tonumber(fields[2]) +local patch = tonumber(fields[3]) + +if not (major and minor and patch) then +return nil, errmsg +end + +return { +major = major, +minor = minor, +patch = patch, +} +end + + +local function compare_semantic_version(v1, v2) +local ver1, err = parse_semantic_version(v1) +if not ver1 then +return nil, err +end + +local ver2, err = parse_semantic_version(v2) +if not ver2 then +return nil, err +end + +if ver1.major ~= ver2.major then +return ver1.major < ver2.major +end + +if ver1.minor ~= ver2.minor then +return ver1.minor < ver2.minor +end + +return ver1.patch < ver2.patch +end + + +function _M.init(env, show_output) +-- read_yaml_conf +local yaml_conf, err = file.read_yaml_conf(env.apisix_home) +if not yaml_conf then +util.die("failed to read local yaml config of apisix: ", err) +end + +if not yaml_conf.apisix then +util.die("failed to read `apisix` field from yaml file when init etcd") +end + +if yaml_conf.apisix.config_center ~= "etcd" then +return true +end + +if not yaml_conf.etcd then +util.die("failed to read `etcd` field from yaml file when init etcd") +end + +local etcd_conf = yaml_conf.etcd + +local timeout = etcd_conf.timeout or 3 +local uri + +-- convert old single etcd config to multiple etcd config +if type(yaml_conf.etcd.host) == "string" then +yaml_conf.etcd.host = {yaml_conf.etcd.host} +end + +local host_count = #(yaml_conf.etcd.host) +local scheme +for i = 1, host_count do +local host = yaml_conf.etcd.host[i] +local fields = util.split(host, "://") +if not fields then +util.die("malformed etcd endpoint: ", host, "\n") +end + +if not scheme then +scheme = fields[1] +elseif scheme ~= fields[1] then +print([[WARNING: mixed protocols among etcd endpoints]]) +end +end + +-- check the etcd cluster version +for index, host in ipairs(yaml_conf.etcd.host) do +uri = host .. "/version" +local cmd = str_format("curl -s -m %d %s", timeout * 2, uri) +local res = util.execute_cmd(cmd) +local errmsg = str_format("got malformed version message: \"%s\" from etcd\n", + res) + +local body, _, err = dkjson.decode(res) +if err then +util.die(errmsg) +end + +local cluster_version = body["etcdcluster"] +if not cluster_version then +util.die(errmsg) +end + +if compare_semantic_version(cluster_version, env.min_etcd_version) then +util.die("etcd cluster version ", cluster_version, + " is less than the required version ", + env.min_etcd_version, + ", please upgrade your etcd cluster\n") +end +end + +local etcd_ok = false +for index, host in ipairs(yaml_conf.etcd.host) do +local is_success = true + +for _, dir_name in ipairs({"/routes", "/upstreams", "/services", +
[GitHub] [apisix] tokers commented on a change in pull request #2685: refactor: moved etcd initialiation to apisix/cli/etcd.lua
tokers commented on a change in pull request #2685: URL: https://github.com/apache/apisix/pull/2685#discussion_r525753350 ## File path: apisix/cli/etcd.lua ## @@ -0,0 +1,205 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +local base64_encode = require("base64").encode +local dkjson = require("dkjson") +local util = require("apisix.cli.util") +local file = require("apisix.cli.file") + +local type = type +local ipairs = ipairs +local print = print +local tonumber = tonumber +local str_format = string.format + +local _M = {} + + +local function parse_semantic_version(ver) +local errmsg = "invalid semantic version: " .. ver + +local parts = util.split(ver, "-") +if #parts > 2 then +return nil, errmsg +end + +if #parts == 2 then +ver = parts[1] +end + +local fields = util.split(ver, ".") +if #fields ~= 3 then +return nil, errmsg +end + +local major = tonumber(fields[1]) +local minor = tonumber(fields[2]) +local patch = tonumber(fields[3]) + +if not (major and minor and patch) then +return nil, errmsg +end + +return { +major = major, +minor = minor, +patch = patch, +} +end + + +local function compare_semantic_version(v1, v2) +local ver1, err = parse_semantic_version(v1) +if not ver1 then +return nil, err +end + +local ver2, err = parse_semantic_version(v2) +if not ver2 then +return nil, err +end + +if ver1.major ~= ver2.major then +return ver1.major < ver2.major +end + +if ver1.minor ~= ver2.minor then +return ver1.minor < ver2.minor +end + +return ver1.patch < ver2.patch +end + + +function _M.init(env, show_output) +-- read_yaml_conf +local yaml_conf, err = file.read_yaml_conf(env.apisix_home) +if not yaml_conf then +util.die("failed to read local yaml config of apisix: ", err) +end + +if not yaml_conf.apisix then +util.die("failed to read `apisix` field from yaml file when init etcd") +end + +if yaml_conf.apisix.config_center ~= "etcd" then +return true +end + +if not yaml_conf.etcd then +util.die("failed to read `etcd` field from yaml file when init etcd") +end + +local etcd_conf = yaml_conf.etcd + +local timeout = etcd_conf.timeout or 3 +local uri + +-- convert old single etcd config to multiple etcd config +if type(yaml_conf.etcd.host) == "string" then +yaml_conf.etcd.host = {yaml_conf.etcd.host} +end + +local host_count = #(yaml_conf.etcd.host) +local scheme +for i = 1, host_count do +local host = yaml_conf.etcd.host[i] +local fields = util.split(host, "://") +if not fields then +util.die("malformed etcd endpoint: ", host, "\n") +end + +if not scheme then +scheme = fields[1] +elseif scheme ~= fields[1] then +print([[WARNING: mixed protocols among etcd endpoints]]) +end +end + +-- check the etcd cluster version +for index, host in ipairs(yaml_conf.etcd.host) do +uri = host .. "/version" +local cmd = str_format("curl -s -m %d %s", timeout * 2, uri) +local res = util.execute_cmd(cmd) +local errmsg = str_format("got malformed version message: \"%s\" from etcd\n", + res) + +local body, _, err = dkjson.decode(res) +if err then +util.die(errmsg) +end + +local cluster_version = body["etcdcluster"] +if not cluster_version then +util.die(errmsg) +end + +if compare_semantic_version(cluster_version, env.min_etcd_version) then +util.die("etcd cluster version ", cluster_version, + " is less than the required version ", + env.min_etcd_version, + ", please upgrade your etcd cluster\n") +end +end + +local etcd_ok = false +for index, host in ipairs(yaml_conf.etcd.host) do +local is_success = true + +for _, dir_name in ipairs({"/routes", "/upstreams", "/services", +
[GitHub] [apisix] starsz commented on issue #2777: request help: How to close X-Forwarded* and X-Real-IP in requests
starsz commented on issue #2777: URL: https://github.com/apache/apisix/issues/2777#issuecomment-729381611 Hi, I think there is a temporary solution. If your apisix version is earlier than or equal to 2.0, you can change your `/bin/apisix`, comment the line like this ``` #proxy_set_header X-Forwarded-For $var_x_forwarded_for; #proxy_set_header X-Forwarded-Proto$var_x_forwarded_proto; #proxy_set_header X-Forwarded-Host $var_x_forwarded_host; #proxy_set_header X-Forwarded-Port $var_x_forwarded_port; #proxy_set_header X-Real-IP $remote_addr; ``` and reload the apisix. If your apisix is on the master branch, you should do the same things as above on `apisix/cli/ngx_tpl.lua` 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander commented on a change in pull request #2685: refactor: moved etcd initialiation to apisix/cli/etcd.lua
spacewander commented on a change in pull request #2685: URL: https://github.com/apache/apisix/pull/2685#discussion_r525733685 ## File path: apisix/cli/etcd.lua ## @@ -0,0 +1,205 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +local base64_encode = require("base64").encode +local dkjson = require("dkjson") +local util = require("apisix.cli.util") +local file = require("apisix.cli.file") + +local type = type +local ipairs = ipairs +local print = print +local tonumber = tonumber +local str_format = string.format + +local _M = {} + + +local function parse_semantic_version(ver) +local errmsg = "invalid semantic version: " .. ver + +local parts = util.split(ver, "-") +if #parts > 2 then +return nil, errmsg +end + +if #parts == 2 then +ver = parts[1] +end + +local fields = util.split(ver, ".") +if #fields ~= 3 then +return nil, errmsg +end + +local major = tonumber(fields[1]) +local minor = tonumber(fields[2]) +local patch = tonumber(fields[3]) + +if not (major and minor and patch) then +return nil, errmsg +end + +return { +major = major, +minor = minor, +patch = patch, +} +end + + +local function compare_semantic_version(v1, v2) +local ver1, err = parse_semantic_version(v1) +if not ver1 then +return nil, err +end + +local ver2, err = parse_semantic_version(v2) +if not ver2 then +return nil, err +end + +if ver1.major ~= ver2.major then +return ver1.major < ver2.major +end + +if ver1.minor ~= ver2.minor then +return ver1.minor < ver2.minor +end + +return ver1.patch < ver2.patch +end + + +function _M.init(env, show_output) +-- read_yaml_conf +local yaml_conf, err = file.read_yaml_conf(env.apisix_home) +if not yaml_conf then +util.die("failed to read local yaml config of apisix: ", err) +end + +if not yaml_conf.apisix then +util.die("failed to read `apisix` field from yaml file when init etcd") +end + +if yaml_conf.apisix.config_center ~= "etcd" then +return true +end + +if not yaml_conf.etcd then +util.die("failed to read `etcd` field from yaml file when init etcd") +end + +local etcd_conf = yaml_conf.etcd + +local timeout = etcd_conf.timeout or 3 +local uri + +-- convert old single etcd config to multiple etcd config +if type(yaml_conf.etcd.host) == "string" then +yaml_conf.etcd.host = {yaml_conf.etcd.host} +end + +local host_count = #(yaml_conf.etcd.host) +local scheme +for i = 1, host_count do +local host = yaml_conf.etcd.host[i] +local fields = util.split(host, "://") +if not fields then +util.die("malformed etcd endpoint: ", host, "\n") +end + +if not scheme then +scheme = fields[1] +elseif scheme ~= fields[1] then +print([[WARNING: mixed protocols among etcd endpoints]]) +end +end + +-- check the etcd cluster version +for index, host in ipairs(yaml_conf.etcd.host) do +uri = host .. "/version" +local cmd = str_format("curl -s -m %d %s", timeout * 2, uri) +local res = util.execute_cmd(cmd) +local errmsg = str_format("got malformed version message: \"%s\" from etcd\n", + res) + +local body, _, err = dkjson.decode(res) +if err then +util.die(errmsg) +end + +local cluster_version = body["etcdcluster"] +if not cluster_version then +util.die(errmsg) +end + +if compare_semantic_version(cluster_version, env.min_etcd_version) then +util.die("etcd cluster version ", cluster_version, + " is less than the required version ", + env.min_etcd_version, + ", please upgrade your etcd cluster\n") +end +end + +local etcd_ok = false +for index, host in ipairs(yaml_conf.etcd.host) do +local is_success = true + +for _, dir_name in ipairs({"/routes", "/upstreams", "/services", +
[GitHub] [apisix] tokers edited a comment on issue #2777: request help: How to close X-Forwarded* and X-Real-IP in requests
tokers edited a comment on issue #2777: URL: https://github.com/apache/apisix/issues/2777#issuecomment-729351415 We may need to add some notes in document of plugin proxy-rewrite to state that several headers can not be overridden/deleted by proxy-rewrite plugin (if we don't modify the existing features). 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers commented on issue #2777: request help: How to close X-Forwarded* and X-Real-IP in requests
tokers commented on issue #2777: URL: https://github.com/apache/apisix/issues/2777#issuecomment-729351415 We may need to add some notes in document of plugin proxy-rewrite to state that several headers can not be overridden/deleted by proxy-rewrite plugin. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Yiyiyimu commented on issue #2110: request help: move `conf/cert` to `t/cert`
Yiyiyimu commented on issue #2110: URL: https://github.com/apache/apisix/issues/2110#issuecomment-729351421 And there is another problem. I'm not sure the usage and difference between `apisix_admin_ssl.crt` and `apisix.crt`, but currently `apisix_admin_ssl.crt` could be customized in https://github.com/apache/apisix/blob/0ff2ab824264c1e55fafa489143e4cd68d7cc7bf/apisix/cli/ngx_tpl.lua#L236-L247 but `apisix.crt` is hard-set to https://github.com/apache/apisix/blob/0ff2ab824264c1e55fafa489143e4cd68d7cc7bf/apisix/cli/ngx_tpl.lua#L326-L327 Do we need to let users also customize `apisix.crt` 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers commented on issue #2777: request help: How to close X-Forwarded* and X-Real-IP in requests
tokers commented on issue #2777: URL: https://github.com/apache/apisix/issues/2777#issuecomment-729350557 @Applenice Could you introduce your demands why these headers shouldn't be passed? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers commented on issue #2777: request help: How to close X-Forwarded* and X-Real-IP in requests
tokers commented on issue #2777: URL: https://github.com/apache/apisix/issues/2777#issuecomment-729350204 > @Applenice See https://github.com/apache/apisix/blob/master/doc/plugins/proxy-rewrite.md for details. Just some snippets reference: > > > headers > > object > > optional > > > > > > Forward to the new headers of the upstream, can set up multiple. If it exists, will rewrite the header, otherwise will add the header. You can set the corresponding value to an empty string to remove a header. Sorry, these headers are set explicitly in the nginx.conf template, which always passed to upstream. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] juzhiyuan commented on a change in pull request #2732: docs: add Attention message for 'response-rewrite' doc.
juzhiyuan commented on a change in pull request #2732: URL: https://github.com/apache/apisix/pull/2732#discussion_r525709907 ## File path: doc/zh-cn/plugins/response-rewrite.md ## @@ -85,3 +94,29 @@ X-Server-status: on {"code":"ok","message":"new json body"} ``` + +### 禁用插件 + +禁用`response-rewrite`插件很简单。你不需要重新启动服务,只需要在插件配置中删除相应的 json 配置,它将立即生效。 + +```shell +curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' +{ +"methods": ["GET"], +"uri": "/test/index.html", +"upstream": { +"type": "roundrobin", +"nodes": { +"127.0.0.1:80": 1 +} +} +}' +``` + +## 注意事项 + +`ngx.exit`将中断当前请求的执行,并返回状态码给 Nginx。 + +![](https://cdn.jsdelivr.net/gh/Miss-you/img/picgo/20201113010623.png) Review comment: Will this link be stable? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers commented on issue #2774: request help: Advanced routing settings
tokers commented on issue #2774: URL: https://github.com/apache/apisix/issues/2774#issuecomment-729347542 > Hi, @aijunziaixifu, As the @spacewander answered in #2763, you can write your filter function. > > Here, I give you an example, you can have a try. > > ``` > curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '{ > "uri": "/index.html", > "methods": ["PUT", "GET"], > "upstream": { > "type": "roundrobin", > "nodes": { > "39.97.63.215:80": 1 > } > }, > "filter_func": "function(vars) > local core = require (\"apisix.core\") > local body, err = core.request.get_body() > if not body then > return false > end > > local data, err = core.json.decode(body) > if not data then > return false > end > > if data[\"a\"] == \"b\" then > return true > end > > return false > end" > }' > ``` > > By the way, I had seen many people have questions about this. May I add this to the document? That can be classified as one section of "Apache APISIX Best Practices". 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Firstsawyou commented on a change in pull request #2776: feat(proxy-cache): the cache_zone field in the schema should be optional
Firstsawyou commented on a change in pull request #2776: URL: https://github.com/apache/apisix/pull/2776#discussion_r525700820 ## File path: doc/plugins/proxy-cache.md ## @@ -31,7 +31,7 @@ The proxy-cache plugin, which provides the ability to cache upstream response da | Name | Type | Requirement | Default | Valid | Description | | -- | -- | --- | - | --- | | -| cache_zone | string | required| | | Specify which cache area to use, each cache area can be configured with different paths. In addition, cache areas can be predefined in conf/config.yaml file | +| cache_zone | string | optional| disk_cache_one | | Specify which cache area to use, each cache area can be configured with different paths. In addition, cache areas can be predefined in conf/config.yaml file | Review comment: Nice, this sounds great. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers commented on pull request #2685: refactor: moved etcd initialiation to apisix/cli/etcd.lua
tokers commented on pull request #2685: URL: https://github.com/apache/apisix/pull/2685#issuecomment-729346485 @membphis Rebased. @spacewander Changes about configuration vars was moved to `apisix/cli/file.lua`, please help me to check whether any faults brought in due to this rebasing. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Firstsawyou commented on a change in pull request #2776: feat(proxy-cache): the cache_zone field in the schema should be optional
Firstsawyou commented on a change in pull request #2776: URL: https://github.com/apache/apisix/pull/2776#discussion_r525698125 ## File path: doc/zh-cn/plugins/proxy-cache.md ## @@ -31,7 +31,7 @@ | 名称 | 类型 | 必选项 | 默认值| 有效值 | 描述 | | -- | -- | -- | - | --- | -- | -| cache_zone | string | 必须 | | | 指定使用哪个缓存区域,不同的缓存区域可以配置不同的路径,在conf/config.yaml文件中可以预定义使用的缓存区域 | +| cache_zone | string | 可选 |disk_cache_one | | 指定使用哪个缓存区域,不同的缓存区域可以配置不同的路径,在conf/config.yaml文件中可以预定义使用的缓存区域 | Review comment: I will update later. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers commented on a change in pull request #2685: refactor: moved etcd initialiation to apisix/cli/etcd.lua
tokers commented on a change in pull request #2685: URL: https://github.com/apache/apisix/pull/2685#discussion_r525696266 ## File path: apisix/cli/etcd.lua ## @@ -0,0 +1,205 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +local base64_encode = require("base64").encode +local dkjson = require("dkjson") +local util = require("apisix.cli.util") +local file = require("apisix.cli.file") + +local type = type +local ipairs = ipairs +local print = print +local tonumber = tonumber +local str_format = string.format + +local _M = {} + + +local function parse_semantic_version(ver) +local errmsg = "invalid semantic version: " .. ver + +local parts = util.split(ver, "-") +if #parts > 2 then +return nil, errmsg +end + +if #parts == 2 then +ver = parts[1] +end + +local fields = util.split(ver, ".") +if #fields ~= 3 then +return nil, errmsg +end + +local major = tonumber(fields[1]) +local minor = tonumber(fields[2]) +local patch = tonumber(fields[3]) + +if not (major and minor and patch) then +return nil, errmsg +end + +return { +major = major, +minor = minor, +patch = patch, +} +end + + +local function compare_semantic_version(v1, v2) +local ver1, err = parse_semantic_version(v1) +if not ver1 then +return nil, err +end + +local ver2, err = parse_semantic_version(v2) +if not ver2 then +return nil, err +end + +if ver1.major ~= ver2.major then +return ver1.major < ver2.major +end + +if ver1.minor ~= ver2.minor then +return ver1.minor < ver2.minor +end + +return ver1.patch < ver2.patch +end + + +function _M.init(env, show_output) +-- read_yaml_conf +local yaml_conf, err = file.read_yaml_conf(env.apisix_home) +if not yaml_conf then +util.die("failed to read local yaml config of apisix: ", err) +end + +if not yaml_conf.apisix then +util.die("failed to read `apisix` field from yaml file when init etcd") +end + +if yaml_conf.apisix.config_center ~= "etcd" then +return true +end + +if not yaml_conf.etcd then +util.die("failed to read `etcd` field from yaml file when init etcd") +end + +local etcd_conf = yaml_conf.etcd + +local timeout = etcd_conf.timeout or 3 +local uri + +--convert old single etcd config to multiple etcd config Review comment: Updated. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Firstsawyou opened a new issue #2778: DISCUSS(kafka-logger): the key field should be optional
Firstsawyou opened a new issue #2778: URL: https://github.com/apache/apisix/issues/2778 ### Issue description In the schema of the kafka-logger plugin, the key field is mandatory, as shown below: ``` .. properties = { .. key = {type = "string"}, .. }, required = {"broker_list", "kafka_topic", "key"} .. ``` I think the key field should be optional, because when a message is sent to the Kafka service, the key can be specified or empty. So when the key is empty, it can be used normally. The key should be optional in the schema: ``` .. properties = { .. key = {type = "string"}, .. }, required = {"broker_list", "kafka_topic"} .. ``` 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] starsz commented on issue #2774: request help: Advanced routing settings
starsz commented on issue #2774: URL: https://github.com/apache/apisix/issues/2774#issuecomment-729340051 Hi, @aijunziaixifu, As the @spacewander answered in https://github.com/apache/apisix/issues/2763, you can write your filter function. Here, I give you an example, you can have a try. ``` curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '{ "uri": "/index.html", "methods": ["PUT", "GET"], "upstream": { "type": "roundrobin", "nodes": { "39.97.63.215:80": 1 } }, "filter_func": "function(vars) local core = require (\"apisix.core\") local body, err = core.request.get_body() if not body then return false end local data, err = core.json.decode(body) if not data then return false end if data[\"a\"] == \"b\" then return true end return false end" }' ``` By the way, I had seen many people have questions about this. May I add this to the document? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers edited a comment on issue #2777: request help: How to close X-Forwarded* and X-Real-IP in requests
tokers edited a comment on issue #2777: URL: https://github.com/apache/apisix/issues/2777#issuecomment-729336401 @Applenice See https://github.com/apache/apisix/blob/master/doc/plugins/proxy-rewrite.md for details. Just some snippets reference: > > headers | object | optional | | | Forward to the new headers of the upstream, can set up multiple. If it exists, will rewrite the header, otherwise will add the header. You can set the corresponding value to an empty string to remove a header. > -- | -- | -- | -- | -- | -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers commented on issue #2777: request help: How to close X-Forwarded* and X-Real-IP in requests
tokers commented on issue #2777: URL: https://github.com/apache/apisix/issues/2777#issuecomment-729336401 @Applenice See https://github.com/apache/apisix/blob/master/doc/plugins/proxy-rewrite.md for details. Just some snippet reference: > > headers | object | optional | | | Forward to the new headers of the upstream, can set up multiple. If it exists, will rewrite the header, otherwise will add the header. You can set the corresponding value to an empty string to remove a header. > -- | -- | -- | -- | -- | -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] gxthrj edited a comment on issue #819: request help: Is it normal that upstreams used by a router can be deleted directly?
gxthrj edited a comment on issue #819: URL: https://github.com/apache/apisix-dashboard/issues/819#issuecomment-729333405 Yes, I think upstream can be deleted directly, and 503 can be used when the route cannot find upstream. In other systems, such as k8s, this way is more respected. The `propagationPolicy` is for GC, the scenario is to delete the `deployment`, which needs to be cascaded to delete replicasets and pods. You should not refer to this feature, because deployment, replicaset, and pod are inherited, they are different from upstream and route binding. In APISIX, the relationship between the `route` and `upstream` can refer to the `service` and `pod` in k8s. They are the selection relationship of the selector label. We can indeed delete all pods, but the `service` is not affected. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] gxthrj commented on issue #819: request help: Is it normal that upstreams used by a router can be deleted directly?
gxthrj commented on issue #819: URL: https://github.com/apache/apisix-dashboard/issues/819#issuecomment-729333405 Yes, I think upstream can be deleted directly, and 503 can be used when the route cannot find upstream. In other systems, such as k8s, this way is more respected. The `propagationPolicy` is for GC, the scenario is to delete the `deployment`, which needs to be cascaded to delete replicasets and pods. You should not refer to this feature, because deployment, replicaset, and pod are inherited, they are different from upstream and route binding. In APISIX, the relationship between the `route` and `upstream` can refer to the `service` and `pod` in k8s. They are the selection relationship of the selector label. We can indeed delete all pods, but the `service` is not affected. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tokers commented on a change in pull request #2685: refactor: moved etcd initialiation to apisix/cli/etcd.lua
tokers commented on a change in pull request #2685: URL: https://github.com/apache/apisix/pull/2685#discussion_r525649569 ## File path: apisix/cli/etcd.lua ## @@ -0,0 +1,205 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +local base64_encode = require("base64").encode +local dkjson = require("dkjson") +local util = require("apisix.cli.util") +local file = require("apisix.cli.file") + +local type = type +local ipairs = ipairs +local print = print +local tonumber = tonumber +local str_format = string.format + +local _M = {} + + +local function parse_semantic_version(ver) +local errmsg = "invalid semantic version: " .. ver + +local parts = util.split(ver, "-") +if #parts > 2 then +return nil, errmsg +end + +if #parts == 2 then +ver = parts[1] +end + +local fields = util.split(ver, ".") +if #fields ~= 3 then +return nil, errmsg +end + +local major = tonumber(fields[1]) +local minor = tonumber(fields[2]) +local patch = tonumber(fields[3]) + +if not (major and minor and patch) then +return nil, errmsg +end + +return { +major = major, +minor = minor, +patch = patch, +} +end + + +local function compare_semantic_version(v1, v2) +local ver1, err = parse_semantic_version(v1) +if not ver1 then +return nil, err +end + +local ver2, err = parse_semantic_version(v2) +if not ver2 then +return nil, err +end + +if ver1.major ~= ver2.major then +return ver1.major < ver2.major +end + +if ver1.minor ~= ver2.minor then +return ver1.minor < ver2.minor +end + +return ver1.patch < ver2.patch +end + + +function _M.init(env, show_output) +-- read_yaml_conf +local yaml_conf, err = file.read_yaml_conf(env.apisix_home) +if not yaml_conf then +util.die("failed to read local yaml config of apisix: ", err) +end + +if not yaml_conf.apisix then +util.die("failed to read `apisix` field from yaml file when init etcd") +end + +if yaml_conf.apisix.config_center ~= "etcd" then +return true +end + +if not yaml_conf.etcd then +util.die("failed to read `etcd` field from yaml file when init etcd") +end + +local etcd_conf = yaml_conf.etcd + +local timeout = etcd_conf.timeout or 3 +local uri + +--convert old single etcd config to multiple etcd config Review comment: Nice capture. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] Firstsawyou commented on a change in pull request #2685: refactor: moved etcd initialiation to apisix/cli/etcd.lua
Firstsawyou commented on a change in pull request #2685: URL: https://github.com/apache/apisix/pull/2685#discussion_r525646617 ## File path: apisix/cli/etcd.lua ## @@ -0,0 +1,205 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +local base64_encode = require("base64").encode +local dkjson = require("dkjson") +local util = require("apisix.cli.util") +local file = require("apisix.cli.file") + +local type = type +local ipairs = ipairs +local print = print +local tonumber = tonumber +local str_format = string.format + +local _M = {} + + +local function parse_semantic_version(ver) +local errmsg = "invalid semantic version: " .. ver + +local parts = util.split(ver, "-") +if #parts > 2 then +return nil, errmsg +end + +if #parts == 2 then +ver = parts[1] +end + +local fields = util.split(ver, ".") +if #fields ~= 3 then +return nil, errmsg +end + +local major = tonumber(fields[1]) +local minor = tonumber(fields[2]) +local patch = tonumber(fields[3]) + +if not (major and minor and patch) then +return nil, errmsg +end + +return { +major = major, +minor = minor, +patch = patch, +} +end + + +local function compare_semantic_version(v1, v2) +local ver1, err = parse_semantic_version(v1) +if not ver1 then +return nil, err +end + +local ver2, err = parse_semantic_version(v2) +if not ver2 then +return nil, err +end + +if ver1.major ~= ver2.major then +return ver1.major < ver2.major +end + +if ver1.minor ~= ver2.minor then +return ver1.minor < ver2.minor +end + +return ver1.patch < ver2.patch +end + + +function _M.init(env, show_output) +-- read_yaml_conf +local yaml_conf, err = file.read_yaml_conf(env.apisix_home) +if not yaml_conf then +util.die("failed to read local yaml config of apisix: ", err) +end + +if not yaml_conf.apisix then +util.die("failed to read `apisix` field from yaml file when init etcd") +end + +if yaml_conf.apisix.config_center ~= "etcd" then +return true +end + +if not yaml_conf.etcd then +util.die("failed to read `etcd` field from yaml file when init etcd") +end + +local etcd_conf = yaml_conf.etcd + +local timeout = etcd_conf.timeout or 3 +local uri + +--convert old single etcd config to multiple etcd config Review comment: It would be better to add a space between the comment symbol and the description. ^-^ 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] pahud commented on a change in pull request #2682: fix(doc): broken links
pahud commented on a change in pull request #2682: URL: https://github.com/apache/apisix/pull/2682#discussion_r525644521 ## File path: doc/README.md ## @@ -101,8 +100,6 @@ The recommended approach is to deploy APISIX with [AWS CDK](https://aws.amazon.com/cdk/) on [AWS Fargate](https://aws.amazon.com/fargate/) which helps you decouple the APISIX layer and the upstream layer on top of a fully-managed and secure serverless container compute environment with autoscaling capabilities. -See [this guide](https://github.com/pahud/cdk-samples/blob/master/typescript/apisix/README.md) by [Pahud Hsieh](https://github.com/pahud) and learn how to provision the recommended architecture 100% in AWS CDK. Review comment: ICYMI I have a video talking about what is `Contruct` in Mandarin and I compared it with the `Construct` concept in `The Matrix`. I believe you folks will love it. copy @YuanYingdong @moonming https://www.youtube.com/watch?v=iVNs1NKWqX0&t=793s (13:13") 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] pahud commented on a change in pull request #2682: fix(doc): broken links
pahud commented on a change in pull request #2682: URL: https://github.com/apache/apisix/pull/2682#discussion_r525644521 ## File path: doc/README.md ## @@ -101,8 +100,6 @@ The recommended approach is to deploy APISIX with [AWS CDK](https://aws.amazon.com/cdk/) on [AWS Fargate](https://aws.amazon.com/fargate/) which helps you decouple the APISIX layer and the upstream layer on top of a fully-managed and secure serverless container compute environment with autoscaling capabilities. -See [this guide](https://github.com/pahud/cdk-samples/blob/master/typescript/apisix/README.md) by [Pahud Hsieh](https://github.com/pahud) and learn how to provision the recommended architecture 100% in AWS CDK. Review comment: ICYMI I have a video talking about what is `Contruct` in Mandarin and I compared it with the `Construct` concept in `The Matrix`. I believe you folks will love it. https://www.youtube.com/watch?v=iVNs1NKWqX0&t=793s (13:13") 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] EnableAsync commented on issue #819: request help: Is it normal that upstreams used by a router can be deleted directly?
EnableAsync commented on issue #819: URL: https://github.com/apache/apisix-dashboard/issues/819#issuecomment-729317388 > > > > * I can directly delete the upstream used by route in dashboard. > > > > Is this expected behaviour? > > > > > > > > > Yes, even if the upstream object is used in the route, we are allowed to delete it. > > > if the user is using the dashboard, we can show a warning message for confirming. > > > > > > Yes, we could allow the deletion, which is like what k8s does. > > ok then @EnableAsync what do you think? I found that k8s has a parameter called "propagationPolicy" to control whether dependencies are automatically deleted or not[1]. I think it is possible to add a parameter like this to control whether or not dependencies can be removed. [1] https://kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/#controlling-how-the-garbage-collector-deletes-dependents 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] liuxiran commented on issue #2439: plugin(basic-auth): update the schema
liuxiran commented on issue #2439: URL: https://github.com/apache/apisix/issues/2439#issuecomment-729313435 The solution is the same with https://github.com/apache/apisix/issues/2441, it has already worked well with the apisix master branch and dashboard v2.0 branch. close is now :) 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] liuxiran closed issue #2439: plugin(basic-auth): update the schema
liuxiran closed issue #2439: URL: https://github.com/apache/apisix/issues/2439 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[apisix] branch master updated (8983a8d -> a6678c3)
This is an automated email from the ASF dual-hosted git repository. spacewander pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 8983a8d fix(etcd): avoid getting with prefix (#2772) add a6678c3 fix(hmac-auth): when the request contains escape characters, the signature verification fails (#2749) No new revisions were added by this update. Summary of changes: apisix/plugins/hmac-auth.lua | 45 -- doc/plugins/hmac-auth.md | 18 ++- doc/zh-cn/plugins/hmac-auth.md | 24 ++- t/plugin/hmac-auth.t | 350 - 4 files changed, 412 insertions(+), 25 deletions(-)
[apisix] branch master updated (8983a8d -> a6678c3)
This is an automated email from the ASF dual-hosted git repository. spacewander pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 8983a8d fix(etcd): avoid getting with prefix (#2772) add a6678c3 fix(hmac-auth): when the request contains escape characters, the signature verification fails (#2749) No new revisions were added by this update. Summary of changes: apisix/plugins/hmac-auth.lua | 45 -- doc/plugins/hmac-auth.md | 18 ++- doc/zh-cn/plugins/hmac-auth.md | 24 ++- t/plugin/hmac-auth.t | 350 - 4 files changed, 412 insertions(+), 25 deletions(-)
[GitHub] [apisix] tzssangglass commented on issue #2748: doc(FAQ): "It is unreasonable to only enable passive checking"
tzssangglass commented on issue #2748: URL: https://github.com/apache/apisix/issues/2748#issuecomment-729311979 need to explain how healthcheck works to complete this FAQ? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[apisix] branch master updated (8983a8d -> a6678c3)
This is an automated email from the ASF dual-hosted git repository. spacewander pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 8983a8d fix(etcd): avoid getting with prefix (#2772) add a6678c3 fix(hmac-auth): when the request contains escape characters, the signature verification fails (#2749) No new revisions were added by this update. Summary of changes: apisix/plugins/hmac-auth.lua | 45 -- doc/plugins/hmac-auth.md | 18 ++- doc/zh-cn/plugins/hmac-auth.md | 24 ++- t/plugin/hmac-auth.t | 350 - 4 files changed, 412 insertions(+), 25 deletions(-)
[GitHub] [apisix] tzssangglass closed pull request #2751: docs: how could I only enable passive health check
tzssangglass closed pull request #2751: URL: https://github.com/apache/apisix/pull/2751 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] tzssangglass commented on a change in pull request #2751: docs: how could I only enable passive health check
tzssangglass commented on a change in pull request #2751: URL: https://github.com/apache/apisix/pull/2751#discussion_r525629329 ## File path: FAQ.md ## @@ -288,3 +288,7 @@ By default, APISIX only listens on port 9080 when handling HTTP requests. If you ``` 2. Reload or restart APISIX + +## How could I only enable passive health check? Review comment: ok, I close this PR 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[apisix] branch master updated (8983a8d -> a6678c3)
This is an automated email from the ASF dual-hosted git repository. spacewander pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 8983a8d fix(etcd): avoid getting with prefix (#2772) add a6678c3 fix(hmac-auth): when the request contains escape characters, the signature verification fails (#2749) No new revisions were added by this update. Summary of changes: apisix/plugins/hmac-auth.lua | 45 -- doc/plugins/hmac-auth.md | 18 ++- doc/zh-cn/plugins/hmac-auth.md | 24 ++- t/plugin/hmac-auth.t | 350 - 4 files changed, 412 insertions(+), 25 deletions(-)
[apisix] branch master updated (8983a8d -> a6678c3)
This is an automated email from the ASF dual-hosted git repository. spacewander pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 8983a8d fix(etcd): avoid getting with prefix (#2772) add a6678c3 fix(hmac-auth): when the request contains escape characters, the signature verification fails (#2749) No new revisions were added by this update. Summary of changes: apisix/plugins/hmac-auth.lua | 45 -- doc/plugins/hmac-auth.md | 18 ++- doc/zh-cn/plugins/hmac-auth.md | 24 ++- t/plugin/hmac-auth.t | 350 - 4 files changed, 412 insertions(+), 25 deletions(-)
[GitHub] [apisix] spacewander commented on a change in pull request #2727: feat: Improve zipkin span reporter performance
spacewander commented on a change in pull request #2727: URL: https://github.com/apache/apisix/pull/2727#discussion_r525627348 ## File path: apisix/plugins/zipkin/reporter.lua ## @@ -105,38 +104,68 @@ function _M.report(self, span) annotations = span.logs } -local i = self.pending_spans_n + 1 -self.pending_spans[i] = zipkin_span -self.pending_spans_n = i -end - -function _M.flush(self) -if self.pending_spans_n == 0 then - -return true +self.pending_spans_n = self.pending_spans_n + 1 +if self.processor then +self.processor:push(zipkin_span) end +end -local pending_spans = cjson.encode(self.pending_spans) -self.pending_spans = {} -self.pending_spans_n = 0 - +local function send_span(pending_spans, report) local httpc = resty_http.new() -local res, err = httpc:request_uri(self.endpoint, { +local res = httpc:request_uri(report.endpoint, { method = "POST", headers = { ["content-type"] = "application/json", }, body = pending_spans, +keepalive = 5000, +keepalive_pool = 5 }) --- TODO: on failure, retry? if not res then -return nil, "failed to request: " .. err +return nil, "failed: " .. report.endpoint elseif res.status < 200 or res.status >= 300 then return nil, "failed: " .. res.status .. " " .. res.reason end -return true + return true +end + +function _M.init_processor(self) +local process_conf = { +name = "zipkin_report", +retry_delay = 1, +batch_max_size = 1000, +max_retry_count = 0, +buffer_duration = 60, +inactive_timeout = 5 +} + +local flush = function (entries, batch_max_size) +if not entries then +return true +end + +local pending_spans, err +if batch_max_size == 1 then +pending_spans, err = cjson.encode(entries[1]) Review comment: @gy09535 Therefore we need to use `cjson.safe` instead. Otherwise an error will be thrown when encoding failed. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander closed issue #2710: bug(hmac-auth): when the request contains escape characters, the signature verification fails
spacewander closed issue #2710: URL: https://github.com/apache/apisix/issues/2710 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix] spacewander merged pull request #2749: fix(hmac-auth): when the request contains escape characters, the signature verification fails
spacewander merged pull request #2749: URL: https://github.com/apache/apisix/pull/2749 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[apisix-dashboard] branch v2.0 updated (dac8b04 -> 0a6d8f7)
This is an automated email from the ASF dual-hosted git repository. juzhiyuan pushed a change to branch v2.0 in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. from dac8b04 ci: fix CI fail (#818) add 0a6d8f7 test: add e2e test for config route with service_id or upstream_id (#810) No new revisions were added by this update. Summary of changes: ...ream_test.go => route_service_upstream_test.go} | 247 + 1 file changed, 154 insertions(+), 93 deletions(-) copy api/test/e2e/{upstream_test.go => route_service_upstream_test.go} (53%)
[apisix-dashboard] branch v2.0 updated (dac8b04 -> 0a6d8f7)
This is an automated email from the ASF dual-hosted git repository. juzhiyuan pushed a change to branch v2.0 in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. from dac8b04 ci: fix CI fail (#818) add 0a6d8f7 test: add e2e test for config route with service_id or upstream_id (#810) No new revisions were added by this update. Summary of changes: ...ream_test.go => route_service_upstream_test.go} | 247 + 1 file changed, 154 insertions(+), 93 deletions(-) copy api/test/e2e/{upstream_test.go => route_service_upstream_test.go} (53%)
[apisix-dashboard] branch v2.0 updated (dac8b04 -> 0a6d8f7)
This is an automated email from the ASF dual-hosted git repository. juzhiyuan pushed a change to branch v2.0 in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. from dac8b04 ci: fix CI fail (#818) add 0a6d8f7 test: add e2e test for config route with service_id or upstream_id (#810) No new revisions were added by this update. Summary of changes: ...ream_test.go => route_service_upstream_test.go} | 247 + 1 file changed, 154 insertions(+), 93 deletions(-) copy api/test/e2e/{upstream_test.go => route_service_upstream_test.go} (53%)
[apisix-dashboard] branch v2.0 updated (dac8b04 -> 0a6d8f7)
This is an automated email from the ASF dual-hosted git repository. juzhiyuan pushed a change to branch v2.0 in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. from dac8b04 ci: fix CI fail (#818) add 0a6d8f7 test: add e2e test for config route with service_id or upstream_id (#810) No new revisions were added by this update. Summary of changes: ...ream_test.go => route_service_upstream_test.go} | 247 + 1 file changed, 154 insertions(+), 93 deletions(-) copy api/test/e2e/{upstream_test.go => route_service_upstream_test.go} (53%)
[apisix-dashboard] branch v2.0 updated (dac8b04 -> 0a6d8f7)
This is an automated email from the ASF dual-hosted git repository. juzhiyuan pushed a change to branch v2.0 in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. from dac8b04 ci: fix CI fail (#818) add 0a6d8f7 test: add e2e test for config route with service_id or upstream_id (#810) No new revisions were added by this update. Summary of changes: ...ream_test.go => route_service_upstream_test.go} | 247 + 1 file changed, 154 insertions(+), 93 deletions(-) copy api/test/e2e/{upstream_test.go => route_service_upstream_test.go} (53%)
[GitHub] [apisix] Applenice opened a new issue #2777: request help: How to close X-Forwarded* and X-Real-IP in requests
Applenice opened a new issue #2777: URL: https://github.com/apache/apisix/issues/2777 ### Issue description I don't want X-Forwarded* and X-Real-IP to appear in APISIX proxy rewrite requests, how do I configure it? I found no relevant information. Is there a way to add, but not a way to close? I tried to configure proxy protocol in config.yaml, but it didn't work. https://github.com/apache/apisix/pull/1113 ### Environment * apisix version (cmd: `apisix version`): ``` $ git branch -v * master c1ac7d6 docs: add a English link of node-status.md (#2753) ``` 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] juzhiyuan merged pull request #810: test: add e2e test for config route with service_id or upstream_id
juzhiyuan merged pull request #810: URL: https://github.com/apache/apisix-dashboard/pull/810 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [apisix-dashboard] EnableAsync commented on a change in pull request #810: test: add e2e test for config route with service_id or upstream_id
EnableAsync commented on a change in pull request #810: URL: https://github.com/apache/apisix-dashboard/pull/810#discussion_r525605876 ## File path: api/test/e2e/route_service_upstream_test.go ## @@ -0,0 +1,304 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package e2e + +import ( + "net/http" + "testing" +) + +func TestRoute_Invalid_Service_And_Service(t *testing.T) { + tests := []HttpTestCase{ + { + caseDesc: "use service that not exist - dashboard", + Object: MangerApiExpect(t), + Method: http.MethodPut, + Path: "/apisix/admin/routes/r1", + Body: `{ + "uri": "/hello_", + "service_id": "not-exists" + }`, + Headers: map[string]string{"Authorization": token}, + ExpectStatus: http.StatusBadRequest, + }, + { + caseDesc: "hit invalid route on data plane", + Object: APISIXExpect(t), + Method: http.MethodGet, + Path: "/hello_", + ExpectCode: http.StatusNotFound, + }, + { + caseDesc: "use upstream that not exist", + Object: MangerApiExpect(t), + Method: http.MethodPut, + Path: "/apisix/admin/routes/r1", + Body: `{ + "uri": "/hello_", + "upstream_id": "not-exists" + }`, + Headers: map[string]string{"Authorization": token}, + ExpectStatus: http.StatusBadRequest, + }, + { + caseDesc: "hit invalid route on data plane", + Object: APISIXExpect(t), + Method: http.MethodGet, + Path: "/hello_", + ExpectCode: http.StatusNotFound, + }, + { + caseDesc: "create service and upstream together at the same time", + Object: MangerApiExpect(t), + Method: http.MethodPut, + Path: "/apisix/admin/routes/r1", + Body: `{ + "uri": "/hello_", + "service_id": "not-exists-service", + "upstream_id": "not-exists-upstream" + }`, + Headers: map[string]string{"Authorization": token}, + ExpectStatus: http.StatusBadRequest, + }, + { + caseDesc: "hit invalid route on data plane", + Object: APISIXExpect(t), + Method: http.MethodGet, + Path: "/hello_", + ExpectCode: http.StatusNotFound, + }, + } + for _, tc := range tests { + testCaseCheck(tc) + } +} + +func TestRoute_Create_Service(t *testing.T) { + tests := []HttpTestCase{ + { + caseDesc: "create service", + Object: MangerApiExpect(t), + Method: http.MethodPut, + Path: "/apisix/admin/services/200", + Body: `{ + "upstream": { + "type": "roundrobin", + "nodes": [ + { + "host": "172.16.238.20", Review comment: Thanks for your suggestion, I learned something new, the current e2e uses the docker container provided by github action. This is an automated m
[GitHub] [apisix] gxthrj closed issue #2070: request help: can not running pod in k8s,Readiness probe failed: dial tcp 10.244.0.54:9080: connect: connection refused
gxthrj closed issue #2070: URL: https://github.com/apache/apisix/issues/2070 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org