-
Notifications
You must be signed in to change notification settings - Fork 9
Examples
Ethan Leisinger edited this page Apr 22, 2022
·
6 revisions
Add the following to your static traefik
config.
pilot:
token = "xxxx" # Update to your pilot token
experimental:
plugins:
rewrite-body:
modulename: "github.com/packruler/rewrite-body"
version: "v0.5.1"
Basic dynamic template
# We are able to utilize Go templates (https://pkg.go.dev/text/template) in here which can make defining these much easier
# You can add the following line (including the comment flag (`#`) so YAML processing doesn't freak out
# {{ $theme := "nord" }}
http:
middlewares:
sonarr-theme:
plugin:
rewrite-body:
rewrites:
- regex: </head>
# Now we can reference that variable in our regex replacement for easy consistency
replacement: <link rel="stylesheet" type="text/css" href="https://theme-park.dev/css/base/sonarr/{{ $theme }}.css"></head>
Efficient/Lazy dynamic template 😁: (warning this will make your YAML editor very unhappy but it will work fine)
# Replace `nord` with your theme of choice!
{{ $theme := "nord" }}
http:
middlewares:
# Add any suppported base apps you would like to include in your auto generated middle set. "sonarr" and "radarr are the examples here.
{{ range $index, $app := list "sonarr" "radarr" }}
{{ $app }}-theme:
plugin:
rewritebody:
rewrites:
- regex: </head>
replacement: <link rel="stylesheet" type="text/css" href="https://theme-park.dev/css/base/{{ $app }}/{{ $theme }}.css"></head>
{{ end }}
http:
middlewares:
theme-headers:
headers:
customRequestHeaders:
accept-encoding: gzip;1.0,deflate;0.5,identity;0.1
# Here is an example middleware to add headers for qBittorrent support
qBittorrent-headers:
headers:
content-security-policy: default-src 'self'; style-src 'self' 'unsafe-inline' theme-park.dev raw.githubusercontent.com use.fontawesome.com; img-src 'self' theme-park.dev raw.githubusercontent.com data:; script-src 'self' 'unsafe-inline'; object-src 'none'; form-action 'self'; frame-ancestors 'self'; font-src use.fontawesome.com;
This is an example of how to set request headers to prioritize supported encoding.