0

Is there any way to configure a plugin to trigger only for a given method or set of methods?

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

1 Answers1

2

You should put the method on the route level

-routes: 
  - name: some-route
    methods:
      - GET # Only run plugin for GET
    paths:
      - /some-path
    plugins:
      - name: some-plugin
          
          configuration:
            some-config:
            - foo
          
Ôrel
  • 7,044
  • 3
  • 27
  • 46