jamesmcroft / traefik-plugin-return-response

Return response is a middleware plugin for Traefik which takes an incoming request on a specific HTTP method and returns a custom response.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Return Static Response

Return static response is a middleware plugin for Traefik which takes an incoming request on a specific HTTP method and path match, and then returns a static response.

Configuration

Static

pilot:
  token: "xxxx"

experimental:
  plugins:
    returnStaticResponse:
      moduleName: github.com/jamesmcroft/traefik-plugin-return response
      version: "v1.0.0"

Dynamic

To configure the Return Static Response plugin you should create a middleware in your dynamic configuration as explained here. The following example creates and uses the returnStaticResponse middleware plugin to return a static response for a specific path.

http:
  services:
    serviceRoot:
      loadBalancer:
        servers:
          - url: "http://localhost:8080"

  middlewares:
    options-static-response:
      plugin:
        returnStaticResponse:
          response:
            method: "OPTIONS"
            url_match: "^http://localhost:8080/(.+)$"
            status_code: 200

  routers:
    routerRoot:
      rule: "PathPrefix(`/`)"
      service: "serviceRoot"
      middlewares:
        - "options-static-response"

About

Return response is a middleware plugin for Traefik which takes an incoming request on a specific HTTP method and returns a custom response.

License:MIT License


Languages

Language:Go 95.4%Language:Makefile 4.6%