Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/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.
https://github.com/jamesmcroft/traefik-plugin-return-response
traefik traefik-plugin
Last synced: 28 days ago
JSON representation
Return response is a middleware plugin for Traefik which takes an incoming request on a specific HTTP method and returns a custom response.
- Host: GitHub
- URL: https://github.com/jamesmcroft/traefik-plugin-return-response
- Owner: jamesmcroft
- License: mit
- Created: 2024-04-17T07:59:05.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-04-17T09:41:49.000Z (7 months ago)
- Last Synced: 2024-06-19T11:38:17.020Z (5 months ago)
- Topics: traefik, traefik-plugin
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```yaml
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](https://docs.traefik.io/middlewares/overview/) in your dynamic configuration as explained [here](https://doc.traefik.io/traefik/middlewares/overview/). The following example creates and uses the `returnStaticResponse` middleware plugin to return a static response for a specific path.
```yaml
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: 200routers:
routerRoot:
rule: "PathPrefix(`/`)"
service: "serviceRoot"
middlewares:
- "options-static-response"
```