将 Kong 插件配置为仅触发一种或多种方法?

Configure Kong plugin to only trigger for one or more methods?

是否有任何方法可以将插件配置为仅针对给定方法或一组方法触发?

-routes: 
  - name: some-route
  - paths:
      - /some-path
      plugins:
        - name: some-plugin
          methods: GET # Only run plugin for GET
          configuration:
            some-config:
            - foo
          

你应该把方法放在路由级别

-routes: 
  - name: some-route
    methods:
      - GET # Only run plugin for GET
    paths:
      - /some-path
    plugins:
      - name: some-plugin
          
          configuration:
            some-config:
            - foo