APIcast
APIcast copied to clipboard
Standalone configuration route match regex support
Standalone configuration route match doesn't support to specify a regex.
Version
nginx version: openresty/1.15.8.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
built with OpenSSL 1.1.0h 27 Mar 2018
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl/include' --add-module=../ngx_devel_kit-0.3.1rc1 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.15 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.7 --add-module=../ngx_stream_lua-0.0.7 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl/lib' --with-pcre-jit --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_auth_request_module --with-http_secure_link_module --with-http_random_index_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-dtrace-probes --with-stream --with-stream_ssl_preread_module --with-http_ssl_module
Steps To Reproduce
- Start apicast with this config:
{
"global": {
"log_level": "notice",
"error_log": "/dev/stderr",
"access_log": "/dev/stdout"
},
"server": {
"listen": [
{
"port": 8080,
"name": "default",
"protocol": "http"
},
{
"port": 8090,
"name": "management",
"protocol": "http"
}
]
},
"routes": [
{
"name": "get-root",
"match": {
"uri_path": "/*",
"http_method": "GET"
},
"destination": {
"service": "testapi"
}
},
{
"name": "management",
"match": {
"server_port": "management"
},
"destination": {
"service": "management"
}
}
],
"internal": [
{
"name": "testapi",
"policy_chain": [],
"upstream": "http://echo-api.3scale.net:80"
},
{
"name": "management",
"policy_chain": [
{
"policy": "apicast.policy.management"
}
]
}
],
"external": []
}
- curl -X GET localhost:8080/test
Current Result
APIcast returns 404
but curl -X GET 'localhost:8080/*'
outputs echo-api.3scale.net response.
Expected Result
The output of the echo-api.3scale.net upstream.
The code always compares what's in match.uri_path
with the request path using ==
.
@jmprusi , @mikz Should we always interpret match.uri_path
as a regex and check if it matches the path? Not sure if you want to do that or introduce things like starts_with
, matches_exactly
, etc. Do you have a spec in Ostia that defines this?
I think it should not be a regex by default. That would force everyone to write regexes or we would need to do transformations. I think we first need to define how this is supposed to work exactly in Ostia and then write a proposal for the standalone config. I don't feel there is anything to be done right now.