Commit Graph

494 Commits

Author SHA1 Message Date
罗泽轩
0f15939a9c
fix: compare if the interceptors are injected by ourselves (#2484)
fix #2482.
2020-10-21 20:34:32 +08:00
Joey
127dac9ebb
feat(prometheus): Add consumer metric data support (#2469)
* feat: Add consumer support for prometheus metrics

Signed-off-by: imjoey <majunjiev@gmail.com>

* Add more detailed comments for newly added consumer label

Signed-off-by: imjoey <majunjiev@gmail.com>
2020-10-21 09:32:52 +08:00
罗泽轩
ed1f08f926
fix(limit-conn): conn and default_conn_delay should > 0 (#2478)
Close #2472.
2020-10-20 20:45:51 +08:00
罗泽轩
5906c73a07
fix: we didn't traverse the plugin interceptors correctly (#2462)
This bug is introduced in 6a543a9.
2020-10-19 15:55:32 +08:00
Alex Zhang
71dcf367d3
change: read 8bytes from /dev/urandom as the random seed for better randomness (#2437) 2020-10-19 14:53:48 +08:00
JinChen
5fcbb4de9c
plugin(consumer-restriction): use draft7 way to rewrite the JSON Schema. (#2440)
fix: #2402
2020-10-19 09:55:08 +08:00
JinChen
9e1030ee42
feat: limit-count plugin supports limiting requests by consumer name. (#2421)
fixed #2333
2020-10-17 19:24:55 +08:00
haifeng9414
3bb670b521
bugfix: set route priority for router radixtree_host_uri. (#2447)
Fix: #2423.
2020-10-17 19:20:51 +08:00
nic-chen
a92331c27a
feature: add managed fields in json schema for resources, such as create_time and update_time (#2444)
* feature: add managed fields in jsonschema for resources, such as create_time and update_time
2020-10-17 18:48:02 +08:00
罗泽轩
6a543a98a2
feat: use interceptors to protect plugin's route (#2416) 2020-10-17 17:45:26 +08:00
Firstsawyou
d1729c0af3
feat: In dns parse, when the parameter resolvers is empty, the local dns is used as resolvers by default (#2424)
fix #2422
2020-10-17 13:44:53 +08:00
YuanSheng Wang
c65f5c9465
feature: plugin limit-count support to use redis cluster (#2406)
fix #638

Co-authored-by: liuheng <liuhengloveyou@gmail.com>
2020-10-17 08:21:47 +08:00
YuanSheng Wang
78910d828b
CI: turn off the Lua code coverage check in CI. (#2435)
We don't enable Lua code override now, its output is unstable and this is unacceptable.

Disabling the Lua code override first will make CI run faster.

* test: print more information when failed.
2020-10-16 09:59:30 +08:00
罗泽轩
b5fe9ced45
change: use 405 as the error code for unsupported HTTP method (#2418) 2020-10-16 09:02:35 +08:00
罗泽轩
4f535e7401
fix(prometheus): don't provide etcd metrics when you don't use it (#2396) 2020-10-14 16:02:08 +08:00
YuanSheng Wang
5614a95758
feat(http-logger): support for specified the log formats via admin API (#2309)
curl http://****/apisix/admin/plugin_metadata/http-logger -d '
{
    "log_format": {
        "host": "$host",
        "@timestamp": "$time_iso8601",
        "client_ip": "$remote_addr"
    }
}'

when we enabled plugin http-logger, we will get the message body like:

{"host":"localhost","@timestamp":"2020-09-23T18:29:07-04:00","client_ip":"127.0.0.1","route_id":"1"}
{"host":"localhost","@timestamp":"2020-09-23T18:29:07-04:00","client_ip":"127.0.0.1","route_id":"1"}
2020-10-13 14:21:54 +08:00
dabue
40577ee1e2
chore: remove the folder 'logs' in root and replace baidu.com with github.com in test cases (#2374)
* rm log

* replace baidu.com to github.com in testcases

* keep folder logs

* remove the folder logs

* update Makefile
2020-10-12 23:49:43 +08:00
罗泽轩
b8e4b8589d
change(hmac-auth): split schema to adapt different occasions (#2386) 2020-10-11 19:18:37 +08:00
YuanSheng Wang
251625d8ab
bugfix: set random seed for each worker process at init_worker phase, only init phase is not enough. (#2357) 2020-10-09 16:39:49 +08:00
YuanSheng Wang
73dfdf2185
feat: add new filed meta_style, collect the request information with original style. (#2364) 2020-10-09 16:33:07 +08:00
Joey
9d0d351226
Add lables for Route/Service/Consumer/SSL (#2345)
Signed-off-by: imjoey <majunjiev@gmail.com>
2020-10-09 14:05:14 +08:00
罗泽轩
5b97223592
feat: implemented referer-restriction plugin (#2352) 2020-10-06 18:20:17 +08:00
Firstsawyou
c3de84e285
feature: support consumer_name as key for limit-req plugin. (#2270)
fix #2267
2020-10-06 18:18:22 +08:00
L
720d135fd2
fix: Update error message when Route doesn't exist (#2304)
Fixes #2302

Co-authored-by: YuanSheng Wang <membphis@gmail.com>
2020-10-06 11:48:52 +08:00
YuanSheng Wang
50c99a5e3b
bugfix: create etcd object in xpcall, this step may fail (#2312)
* bugfix: create the etcd object in `xpcall`, it may fail, the return values of `etcd.new` should be `res, err`.

fix issue: #2310

1. The old process, if creating etcd fails, etcd data will no longer be synchronized. We need to create the etcd object in xpcall.
2. the return value should be res, err of etcd.new.

* test: old test case is unstable, should delete some checkpoint which is wrong.
2020-10-05 10:22:28 +08:00
YuanSheng Wang
5d172d606f
test: use the absolute path of $apisix_home instead of ., search the lua source fine in the folder $apisix_home. (#2348) 2020-10-05 08:42:13 +08:00
YuanSheng Wang
20c670ce09
change(hmac-auth): update the organization of signing_string . (#2337)
fix #2336 .

ref:
https://help.aliyun.com/document_detail/29475.html?spm=a2c4g.11186623.2.15.62c73e789LVg02
https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html#RESTAuthenticationConstructingCanonicalizedAmzHeaders
2020-10-04 19:57:57 +08:00
Firstsawyou
dd5a36e207
feat: support to fetch consumer_name or consumer_id via ctx.var (#2333) 2020-10-04 19:16:29 +08:00
罗泽轩
1db42368c0
fix(basic-auth): split schema to adapt different occasions (#2331) 2020-10-04 14:39:20 +08:00
YuanSheng Wang
c5dcced1cf
bugfix: when service works with upstream that contains a domain name, the merged configuration should not always changing. (#2322) 2020-10-04 13:12:28 +08:00
YuanSheng Wang
05840ca9e2
test: wait for more time and check the error log, old way is unstable. (#2341) 2020-09-30 17:05:46 +08:00
Shuyang Wu
e0ee327c08
bugfix: use etcd:watchcancel to reduce connections in etcdv3 (#2299) 2020-09-28 18:05:47 +08:00
Joey
ebe4f6620a
feat: Add labels for upstream object (#2279) 2020-09-28 11:20:09 +08:00
nic-chen
c375bd0cac
feat: replace timestamp with date and time in GMT format in plugin hmac-auth (#2301) 2020-09-28 09:10:26 +08:00
Firstsawyou
b1770d4ca7
feat: support to fetch route_id and service_id via ctx.var (#2326) 2020-09-27 22:29:59 +08:00
罗泽轩
70bd9802c5
bugfix: avoid overwriting Vary header in cors plugin (#2271) 2020-09-27 16:43:09 +08:00
YuanSheng Wang
65db7a4837
bugfix(lrucache): store the original value in a new table, and use ver to store the cached version. (#2321) 2020-09-27 11:38:05 +08:00
guyang
ce6dc643dd
bugfix: return right response code when http_to_https enabled in redirect plugin. (#2311) 2020-09-27 09:35:28 +08:00
Wen Ming
13b0968340
Revert "feat(http-logger): support for specified the log formats via admin API (#2294)" (#2307)
This reverts commit 89f89f3004.
2020-09-24 23:50:22 +08:00
YuanSheng Wang
89f89f3004
feat(http-logger): support for specified the log formats via admin API (#2294) 2020-09-24 20:45:50 +08:00
YuanSheng Wang
3f9685f823
feat(http-logger): support to concat multiple log with separator. (#2286) 2020-09-24 10:58:44 +08:00
Vinci Xu
7beafd345a
fix: increase wait to avoid fail (#2290) 2020-09-23 22:48:34 +08:00
nic-chen
1b24f36639
feat: support storing metadata for plugins (#2268)
fix #2263
2020-09-23 21:02:56 +08:00
Alex Zhang
36d3b82ec4
bugfix: supported the encryption/decryption for multi priv keys (#2179)
Co-authored-by: Wen Ming <moonbingbing@gmail.com>
2020-09-22 20:37:14 +08:00
Firstsawyou
a651a29e20
feature: allow empty service object, it does not contain any upstream and plugin (#2259) 2020-09-21 16:52:18 +08:00
罗泽轩
8493a607ce
test: also lint the test helpers (#2252)
Close #2215
2020-09-19 19:07:39 +08:00
Firstsawyou
e94a5b3f58
feature: consumer provides access to a collection of service (#2241)
* test: add more test cases.

Co-authored-by: Yuansheng Wang <membphis@gmail.com>
2020-09-19 18:21:21 +08:00
Vinci Xu
89f4389ba7
fix[key-auth]: skip consumer when config has no key (#2120) 2020-09-18 21:49:01 +08:00
nic-chen
0a4bc95e3d
feat: hmac-auth add signed headers to calculate signature (#2239)
Co-authored-by: YuanSheng Wang <membphis@gmail.com>
2020-09-18 20:25:41 +08:00
YuanSheng Wang
03d818e175
test: before creating and deleting routes in batches, clear all routes first (#2253)
* test: set larger timeout.
2020-09-18 18:43:02 +08:00
Alex Zhang
dd6ee5e99f
improve: use optimistic locking to avoid concurrency problem in admin PATCH APIs. (#2216)
There is a potential concurrency problem in all admin PATCH APIs when
two patch requests come in simultaneously, in such case, the patched
result of the first applied request will be overridden, also the
probability is tidy, but from the perspective of software's robust,
that's not what we wanna to see.

In this commit, we use the optimistic locking to avoid this problem, for
the example aforementioned, the second PATCH request will failure, and
it's up to the user to retry this PATCH request again.

The optimistic locking mechanism in ETCD v3 APIs is showed by it's
transcation mechanism.

Signed-off-by: tokers <zchao1995@gmail.com>
2020-09-18 17:20:55 +08:00
YuanSheng Wang
4f900390f9
bugfix: independently check the "disabled" field to avoid schema ve… (#2099)
* bugfix: independently check the "disabled" field to avoid `schema` verification
  with other parameters.
2020-09-17 22:31:02 +08:00
Zhang Qiang
d05071868d
fix: return ok in kafka-logger (#2222) 2020-09-17 15:17:51 +08:00
YuanSheng Wang
68b1f9cc57
bugfix: clear all cached object when got delete action, and removing (#2168)
stale boolean data in table `self.values` with a safer way.
2020-09-17 09:30:44 +08:00
nic-chen
84ce7ba781
feat: add AK/SK(HMAC) auth plugin. (#2192) 2020-09-16 14:27:56 +08:00
Shuyang Wu
4722198548
feature: support etcd v3 by mocking v2 API (#2036) 2020-09-16 10:19:04 +08:00
YuanSheng Wang
12a0b13145
bugfix: use the route's has_domain if it contains any upstream object. (#2211) 2020-09-15 12:12:09 +08:00
nic-chen
087f87a7e4
bugfix: grpc-transcode plugin converts http/json parameters abnormally (#2139)
* fix bug

* optimiz

* update grpc_server_example

* add test cases

* fix: test case

* fix: test case

* return val directly

* fix: test case respond body compare text

* fix test case error

Co-authored-by: Wen Ming <moonbingbing@gmail.com>
2020-09-10 18:02:16 +08:00
罗泽轩
37817e4198
chore: add string utility for simplicity and correctness (#2181)
* chore: add string utility for simplicity and correctness

* localize error

* correct the misuse string.find

Co-authored-by: YuanSheng Wang <membphis@gmail.com>
2020-09-10 16:49:20 +08:00
Alex Zhang
1556cd0d7e
improve: cache parsed certs and pkeys to LRU cache (#2163) 2020-09-10 15:35:55 +08:00
maosy
47d39e7b0e
bugfix: serverless plugin not work in header_filter phase (#2148) 2020-09-09 16:12:32 +08:00
gy
a8621fb5a1
bugfix: updated the value of remaining when count changes in limit-count plugin. (#2121) 2020-09-06 21:52:13 +08:00
gy
d4216831e3
fix: log-rotate.t is unstable (#2164)
fix #2138
2020-09-06 12:10:42 +08:00
nic-chen
502310bef6
feat: support different modes to pass host to upstream (#2132)
* test: using `httpbin.org` for test cases.
* doc: add doc
* remove golang apt repository and runtime in travis.
* download proto file
Co-authored-by: Yuansheng <membphis@gmail.com>
2020-08-30 22:43:28 +08:00
redynasc
98bb5933d6
feature: implement ewma balancer for upstream node (#2001)
ewma is a different balancing implementation that will generate a weight for every backend IP based on the last server response time, basically it tries to dispatch more requests to the backends that reply faster, supposing that they are less loaded.

fix #1996
2020-08-29 23:14:16 +08:00
Vinci Xu
a3f865aa4b
fix: wait time is too short it will easy fail in some bad hardware environment (#2127) 2020-08-27 16:47:09 +08:00
YuanSheng Wang
9070a4fa95
feature: implemented plugin log-rotate, rotate log by interval time. (#2097) 2020-08-26 16:40:36 +08:00
nic-chen
4f83f09eeb
fix: return response code and msg instead of exit directly in plugins. (#2115) 2020-08-25 09:56:45 +08:00
YuanSheng Wang
1aefe915f1
change: update plugin's schema ip-restriction with draft7 way (#2091) 2020-08-24 09:27:49 +08:00
Alex Zhang
2886b2169b
feature: support multiple certificates(RSA and ECC) for single domain (#2089) 2020-08-24 09:23:06 +08:00
YuanSheng Wang
415f9221e2
change: use draft7 of JSON Schema for limit count pulgin (#2102) 2020-08-24 09:17:31 +08:00
YuanSheng Wang
d974c1871a
change: use draft7 style of JSON Schema. (#2100)
fix #2083.
2020-08-22 21:43:21 +08:00
YuanSheng Wang
cf882bda1e
feature: divide config.yaml into two files config-custom.yaml & confi… (#2023)
* feature: divide config.yaml into two files config-custom.yaml & config-default.yaml .

fix #1923
2020-08-18 20:18:55 +08:00
YuanSheng Wang
c2a7359b27
update radixtree to version 2.2 . (#2061)
fix #2058

* fixed test
2020-08-16 16:32:29 +08:00
nic-chen
7525f1fcc9
feat(prometheus): add prometheus metrics node_info(hostname) (#2063)
* using a new metric `node_info` to store the hostname
2020-08-16 09:59:55 +08:00
Swayam Raina
6e0da454d1
feature: add apisix-version info to headers in APISIX core (#1961)
related #1877
2020-08-15 07:24:33 +08:00
Nirojan Selvanathan
240942e941
feature: implemented request-id plugin to uniquely track requests in APISIX (#2026)
fix #2022
2020-08-12 23:09:39 +08:00
罗泽轩
149a66ad40
feat: Vary needs to be used when Access-Control-Allow-Origin is not '*' (#2046)
See https://fetch.spec.whatwg.org/#cors-protocol-and-http-caches.
2020-08-12 09:12:58 +08:00
YuanSheng Wang
6c8a6c3c54
bugfix: when the plug-in configuration that is bound to the consumer is (#2028)
fix #2019
2020-08-12 09:11:40 +08:00
Nirojan Selvanathan
14f979edf8
test: Added test cases for openid connect introspection (#2018)
Fix #1718

* Added test case for token intropsection with Keycloak identity server
* Renamed oauth doc to openid-connect to correctly link with the plugin name
2020-08-08 18:24:42 +08:00
YuanSheng Wang
31f744580d
bugfix: used a table array to store the status, allow the plugin can (#1994)
be called multiple times.

fix #1986
2020-08-07 08:15:44 +08:00
YuanSheng Wang
05f30e1e15
bugfix: support parameter way to match request in route. (#2012)
fix #2008
2020-08-07 08:13:58 +08:00
Nirojan Selvanathan
712a23f9b0
feat: Support SSL verify option to Authz Keycloak plugin (#1924)
Fix #1855
2020-08-06 17:07:07 +08:00
Vinci Xu
2ac47735a1
feat: add '**' for alllow_headers and complete docs (#2004)
fix #1983
2020-08-06 16:13:33 +08:00
Wen Ming
23bc76b5a0
typo: fixed typo about function. (#2007) 2020-08-06 16:06:52 +08:00
YuanSheng Wang
963e29951d
bugfix: passed the copied api_ctx, it may be freed if the api_ctx (#2002)
* bugfix: passed the copied `api_ctx`, it may be freed if the `api_ctx`
  was called in back timer async.

Fixed #1935.
2020-08-06 10:20:34 +08:00
nic-chen
65df727af4
feat: script distribute and run (#1982)
Supporting distribution and execution scripts, we can implement many new features, 
such as plug-in orchestration.
2020-08-05 14:11:22 +08:00
dabue
77dfecaab6
revert: enable proxy-cache and proxy-mirror plugins by default. (#1992)
fixed #1987
2020-08-05 00:20:04 +08:00
YuanSheng Wang
c67e998dad
bugfix: fail to handshake if there is no certificate matched by host. (#1980)
* bugfix: fail to handshake if there is no certificate matched by host.
* fix:  grpc proxy test case
2020-08-04 23:20:34 +08:00
taotao
6adbf02a06
core: support get_scheme/host/port/http_version in core.request (#1978) 2020-08-04 09:36:05 +08:00
YuanSheng Wang
d32b5cf361
perf: no longer generate unnecessary nginx conf for better performance. (#1968)
* perf: no longer generate unnecessary nginx conf for better performance.
* benchmark: sync nginx.conf for fake-apisix.

> Is this PR backward compatible?

Disable two plugins by default(proxy-cache, proxy-mirror), if the user wants to enable them, need to modify the conf/config.yaml by manual.
2020-08-04 09:31:35 +08:00
YuanSheng Wang
e1c6d371a8
doc: update main picture of APISIX. (#1964)
* test case: formatted by `reindex`.
2020-08-02 09:35:37 +08:00
Vinci Xu
2936c7d89d
feat: add option for cors and bugfix (#1963)
fix #1915 #1704
2020-08-01 08:03:22 +08:00
YuanSheng Wang
3d8150b208
test: old test case is unstable, running fail sometimes. (#1925) 2020-07-31 21:24:31 +08:00
YuanSheng Wang
8fc2af56ae
bugfix: avoid to modify the original plugin conf. (#1958)
relate issue: #1934 , #1956
2020-07-31 20:19:12 +08:00
YuanSheng Wang
2ba0231140
bugfix: passive health check seems never provide a healthy report (#1918)
Fix #1640
2020-07-31 19:31:20 +08:00
nic-chen
29b15892b7
feat: support both standard PATCH and sub path PATCH for admin api (#1930)
fix #1823
2020-07-31 09:21:08 +08:00
nic-chen
7f64ba810e
change: add more prometheus metrics(etcd modify index) (#1888)
* feat: add more metrics for prometheus

* test: add test cases

* fix: check lint error

* remove hostname metrics. -> can't save string value.

* add more index

* add X-Etcd-Index

* fix lint

* test: add more test cases

* fix: Avoid the index to exceed 1000 by updating other keys that will causing a full reload

* add prev_index

* fix lint

* fix: fetch key first

* fix: test error

* fix update version only when waitdir error is timeout

* test

* fix: sleep more time

* fix: code style

* fix: code style
2020-07-30 15:27:00 +08:00
YuanSheng Wang
f9a8a26dd4
feature: add a new option, decide if we remove the "/" at the end of … (#1766)
* feature: add a new option, decide if we remove the "/" at the end of the URI before route matching.

fix #1765
2020-07-29 19:25:30 +08:00
YuanSheng Wang
20207c8108
bugfix: read the request body from the temporary file if it was cached. (#1863) 2020-07-29 19:24:27 +08:00