Combining Global and Route-Specific Plugins in ApisixRoute #12024
-
Hi APISIX Team, We are currently facing an issue when trying to combine the use of Scenario:
In this case, both the OIDC and proxy-rewrite plugins are applied, but I need to repeat the OIDC configuration in every ApisixRoute. Question: Is there any supported way to combine a global plugin configuration (such as openid-connect via We’d appreciate any guidance or workarounds you might suggest for this scenario. Thanks in advance for your help! Best regards, Sofia |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @sopacifics! I'm here to help you with any bugs, questions, or contributions. Let's tackle this issue together while we wait for a human maintainer. Yes, there is a supported way to achieve this in APISIX. You can use the ApisixPluginConfig CRD to extract and reuse commonly used plugins and bind them directly to a route. This allows you to avoid duplicating the global configuration on each route. When you use Here's an example of how you can configure this: apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
name: nginx-route
namespace: api-gateway
spec:
http:
- name: nginx-rule
match:
paths:
- /nginx/*
plugin_config_name: nginx-oidc-global
plugins:
- name: proxy-rewrite
enable: true
config:
regex_uri:
- "^/nginx/(.*)"
- "/$1"
backends:
- serviceName: nginx-service
servicePort: 80 In this setup, the To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other |
Beta Was this translation helpful? Give feedback.
Currently, the
plugin_config_name
attribute in APISIX does not support multiple plugin configurations. To handle scenarios where you need different global configurations, such as one for M2M and another for a web app, creating separate routes with distinctplugin_config_name
references is indeed a practical approach.As for future support for multiple
plugin_config_name
attributes, there is no available information or documentation indicating plans to enhance this feature to support multiple configurations [1][2][3].To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Re…