mhh12121 commented on issue #1235: URL: https://github.com/apache/apisix-ingress-controller/issues/1235#issuecomment-1214786814
@tao12345666333 Eventually I found a tricky solution cuz I noticed above https://github.com/apache/apisix-ingress-controller/issues/1235#issuecomment-1211479761 : The plugin_config_ids of route B and C **are the same**: "6f589781" Combined the following log I posted: > @tao12345666333 Thank you. But I did look through the admin's log; With the apisixroute mentioned above, we could see **/backend_docs** was forced to use forward-auth: > > ``` > 2022/08/12 11:44:50 [warn] 44#44: *3203743 [lua] plugin.lua:750: run_plugin(): forward-auth exits with http status code 400, client: 10.23.4.212, server: _, request: "GET /backend_docs HTTP/1.1", host: "10.23.4.212:31684" > 10.23.4.212 - - [12/Aug/2022:11:44:50 +0000] 10.23.4.212:31684 "GET /backend_docs HTTP/1.1" 400 60 0.002 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36" - - - "http://10.23.4.212:31684/backend_docs" > ``` I GUESS they mistook two plugins ; So my solution is **TO DIVIDE THOSE INTO TWO SEPARATE PLUGINS** BY creating seperate **ApisixPluginConfig** resources; for example: ``` apiVersion: apisix.apache.org/v2beta3 kind: ApisixPluginConfig metadata: name: plugin-backend-docs namespace: default spec: plugins: - name: proxy-rewrite enable: true config: uri: "/docs" --- apiVersion: apisix.apache.org/v2beta3 kind: ApisixPluginConfig metadata: name: plugin-backend-api namespace: default spec: plugins: - name: forward-auth enable: true config: uri: "http://auth:8084/user/v0/forward_auth" request_headers: ["Authorization"] upstream_headers: ["user-id"] client_headers: ["Location"] - name: proxy-rewrite enable: true config: regex_uri: ["^/api/(.*)","/$1"] ``` in apisixRoute, what you need to update is to indicate the **plugin_config_name**: ``` apiVersion: apisix.apache.org/v2beta3 kind: ApisixRoute metadata: name: route-backend namespace: default spec: http: - name: a match: paths: - /api/* backends: - serviceName: backend servicePort: 80 resolveGranularity: service plugin_config_name: plugin-backend-api - name: b match: paths: - /openapi.json - /static/* methods: - GET backends: - serviceName: srv-vastml-backend-amd64-svc servicePort: 80 resolveGranularity: service - name: c match: paths: - /backend_docs plugin_config_name: plugin-backend-docs backends: - serviceName: srv-vastml-backend-amd64-svc servicePort: 80 resolveGranularity: service ``` And it seems that 1.4.0 ingress-controller would report something like: ``` "apisixpluginConfig Not registered" ``` Then I upgraded it to **1.4.1**, and it works like a charm! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
