Comments (7)
It seems that \d+
in path is working like .+
tyk-gateway_1 | time="Oct 05 15:45:02" level=debug msg=Started api_id=search api_name=Search mw=VersionCheck org_id=default origin=172.19.0.1 path=/search/v1/abc ts=1696520702660512538
tyk-gateway_1 | time="Oct 05 15:45:02" level=debug msg=Finished api_id=search api_name=Search code=200 mw=VersionCheck ns=57338 org_id=default origin=172.19.0.1 path=/search/v1/abc
What gives?
Only by changing the path to sth like `"(\d+)/foo" I can observe requests being rejected
from tyk.
Same with "\\d+/"
and "[0-9]+/"
from tyk.
It seems to be some problem with single-component paths, since if I do "[0-9]+/foo"
it works as expected
tyk-gateway_1 | time="Oct 05 16:35:52" level=debug msg=Started api_id=search api_name=Search mw=VersionCheck org_id=default origin=172.19.0.1 path=/search/v1/abcd/foo ts=1696523752943944511
tyk-gateway_1 | time="Oct 05 16:35:52" level=debug msg="EVENT FIRED: VersionFailure"
tyk-gateway_1 | time="Oct 05 16:35:52" level=debug msg=Finished api_id=search api_name=Search code=403 error="Requested endpoint is forbidden" mw=VersionCheck ns=135375 org_id=default origin=172.19.0.1 path=/search/v1/abcd/foo
tyk-gateway_1 | time="Oct 05 16:36:10" level=debug msg=Started api_id=search api_name=Search mw=VersionCheck org_id=default origin=172.19.0.1 path=/search/v1/30602/foo ts=1696523770610129310
tyk-gateway_1 | time="Oct 05 16:36:10" level=debug msg=Finished api_id=search api_name=Search code=200 mw=VersionCheck ns=61352 org_id=default origin=172.19.0.1 path=/search/v1/30602/foo
from tyk.
Without the url_rewrites it get's even weirder.
Why is the version component not stripped from the upstream path?!
tyk-gateway_1 | time="Oct 05 17:02:59" level=debug msg=Started api_id=search api_name=Search mw=VersionCheck org_id=default origin=172.19.0.1 path=/search/v1/abcd ts=1696525379064344695
tyk-gateway_1 | time="Oct 05 17:02:59" level=debug msg=Finished api_id=search api_name=Search code=200 mw=VersionCheck ns=44317 org_id=default origin=172.19.0.1 path=/search/v1/abcd
tyk-gateway_1 | time="Oct 05 17:02:59" level=debug msg=Started api_id=search api_name=Search mw=RateCheckMW org_id=default origin=172.19.0.1 path=/search/v1/abcd ts=1696525379064404263
tyk-gateway_1 | time="Oct 05 17:02:59" level=debug msg=Finished api_id=search api_name=Search code=200 mw=RateCheckMW ns=24484 org_id=default origin=172.19.0.1 path=/search/v1/abcd
tyk-gateway_1 | time="Oct 05 17:02:59" level=debug msg="Started proxy"
tyk-gateway_1 | time="Oct 05 17:02:59" level=debug msg="Stripping proxy listen path: /search/"
tyk-gateway_1 | time="Oct 05 17:02:59" level=debug msg="Upstream path is: /v1/abcd"
tyk-gateway_1 | time="Oct 05 17:02:59" level=debug msg=Started api_id=search api_name=Search mw=ReverseProxy org_id=default ts=1696525379064455195
tyk-gateway_1 | time="Oct 05 17:02:59" level=debug msg="Upstream request URL: /v1/abcd" api_id=search api_name=Search mw=ReverseProxy org_id=default
tyk-gateway_1 | time="Oct 05 17:02:59" level=debug msg="Outbound request URL: https://httpbin.org/anything/v1/abcd" api_id=search api_name=Search mw=ReverseProxy org_id=default
tyk-gateway_1 | time="Oct 05 17:02:59" level=debug msg="Creating new transport" api_id=search api_name=Search mw=ReverseProxy org_id=default
tyk-gateway_1 | time="Oct 05 17:02:59" level=debug msg="Out request url: https://httpbin.org/anything/v1/abcd" api_id=search api_name=Search mw=ReverseProxy org_id=default
tyk-gateway_1 | time="Oct 05 17:03:00" level=debug msg=Finished api_id=search api_name=Search mw=ReverseProxy ns=1021647467 org_id=default
from tyk.
Also notice the rewrite is somehow capturing abcd
into a (\d+)
capturing group as 1
tyk-gateway_1 | time="Oct 05 16:57:23" level=debug msg="Rewriter checking matches, len is: 1"
tyk-gateway_1 | time="Oct 05 16:57:23" level=debug msg="[[1 1]]"
tyk-gateway_1 | time="Oct 05 16:57:23" level=debug msg="[[$1]]"
tyk-gateway_1 | time="Oct 05 16:57:23" level=debug msg="URL Re-written from: /search/v1/abcd"
tyk-gateway_1 | time="Oct 05 16:57:23" level=debug msg="URL Re-written to: gateway?projectId=1"
from tyk.
It appears that to get what I want I need to specify "path": "^/search/v1/[0-9]+$"
as regex.
This seems bad, as it forces me to repeat the listen_path and version prefix in every regex.
This is both bloat and makes it hard to reuse the statements for a different listen path or version
from tyk.
Closed in favour of #5601
from tyk.
Related Issues (20)
- Feature Request: Dark/Light Mode Toggle HOT 3
- Tyk API Gateway 5.0.7 : When creating the key for Basic Auth, the key value in responce is "" HOT 1
- OAuth2 client_credentials authentication does not seem to be RFC6749 compliant HOT 3
- Rate limit does not get reset when using more than 1 gateway pods in kubernetes HOT 1
- Optimize rate limit using Lua script
- [Q]: Adding more tests and increasing the Code Coverage HOT 4
- Double response from go plugin virtual endpoint HOT 1
- [TT-5070]Wrong HTTP status code when panic happens inside Go plugin HOT 1
- [TT-11223]ERROR: Tyk PUMP not able to connect to Redis Sentinels HOT 1
- Error with middleware in one gateway while other pods are working fine HOT 1
- KV Store config not read in tyk.conf (security.certificates.upstream) HOT 4
- User not authorized when using basic authentication HOT 1
- OAS API: transformRequestMethod.toMethod expects boolean instead of string HOT 1
- Automatic retries when there are specific errors from Upstream
- How to define proxy.listen_path as exact path? HOT 4
- HTTP/2 Continuation Frame Vulnerability
- graphql playground error for federation
- Add HTTP proxy support to MDCB
- Tyk cannot validate client certificates against a certificate authority
- Profile Raw Editor cursor placement HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tyk.