-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change: global rules should not be executed on the internal api #3396
Changes from all commits
546d42e
e048fd6
2fee219
5afdc50
9f489e4
bba9da8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,6 +89,8 @@ apisix: | |
role: viewer | ||
|
||
delete_uri_tail_slash: false # delete the '/' at the end of the URI | ||
global_rule_skip_internal_api: true # does not run global rule in internal apis | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add test when global_rule_skip_internal_api is false? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to add test when global_rule_skip_internal_api is false. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
sure, test failed now, submit it after solving it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @spacewander teat case added. please help review when you have time, thanks. |
||
# api that path starts with "/apisix" is considered to be internal api | ||
router: | ||
http: 'radixtree_uri' # radixtree_uri: match route by uri(base on radixtree) | ||
# radixtree_host_uri: match route by host + uri(base on radixtree) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can add a configuration in the
config.yaml
for it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spacewander do you mean a switch for it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spacewander
I thought about it again. There shouldn't have a switch here. If skip the
if
branch and continue execution, a 404 will occur because the route does not exist.And I think if need to configure the plugin for the internal api, it is more appropriate to configure a route and then configure the plugin instead of using the global rule.
What do you think ? Looking forward to your opinion. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to provide a switch to execute the global rule before matching internal API or don't execute the global rule. It is not skipped the internal API matched.
We can't configure a plugin for internal API, this is the real problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spacewander Thanks for for the explanation. I know that.., emm, will update later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. We can wait for it.