Installing with Dynamic Config

Inject Coolify Tweaks through Traefik's rewrite-body middleware.

Introduction

Dynamic Config lets Traefik rewrite HTML responses so Coolify Tweaks loads without a browser extension. Once configured, every browser, device, and automation hitting your dashboard will get the polish automatically.

Prerequisites

  • Coolify already running with Traefik (/data/coolify/proxy/docker-compose.yml)
  • You have access to /data/coolify/proxy/

Note: The current guide refers to /data/coolify/proxy/ as a terminal guide, you can also do this through the web interface, by going to Servers -> localhost -> Proxy -> Dynamic Config, and Proxy Configuration.

Steps

Update Traefik Compose

Edit /data/coolify/proxy/docker-compose.yml.

Inside the existing traefik service, add these lines. Don't delete anything already there.

services:
  traefik:
    # ...your existing keys
    ports:
      # existing ports
      - "80:80"
      - "443:443"
      - "8080:8080"
      # ✅ port for the Coolify dashboard entrypoint
      - "3000:3000"
    command:
      # keep your existing flags, then add:
      # ✅ enable rewrite-body plugin to modify HTML
      - "--experimental.plugins.rewritebody.modulename=github.com/packruler/rewrite-body"
      - "--experimental.plugins.rewritebody.version=v1.2.0"
      # ✅ add entrypoint for dashboard traffic on port 3000
      - "--entrypoints.coolify_dashboard.address=:3000"

Save and close. Don't restart yet.

Create Dynamic Config

Create a new file:

/data/coolify/proxy/dynamic/coolify-tweaks.yml

http:
  middlewares:
    rb-buffer:
      buffering:
        maxRequestBodyBytes: 0
        maxResponseBodyBytes: 0
        memResponseBodyBytes: 0
    rb-force-identity:
      headers:
        customRequestHeaders:
          Accept-Encoding: identity
    rb-inject-css:
      plugin:
        rewritebody:
          lastModified: true
          rewrites:
            - regex: "(?is)</head>"
              replacement: '<link rel="stylesheet" href="https://coolify-tweaks-api.techwithanirudh.com/release/latest/?asset=main.css" referrerpolicy="no-referrer" crossorigin="anonymous"></head>'
          monitoring:
            methods: [GET]
            types: ["text/html"]
    coolify-tweaks:
      chain:
        middlewares:
          - rb-buffer
          - rb-force-identity
          - rb-inject-css

This chain:

  • Forces identity encoding (so HTML isn't gzipped before rewrite)
  • Injects your <link> tag before </head>
  • Works on every HTML response served by Traefik

Add Routers

Option A: Local Dashboard (no custom domain)

If you just access Coolify internally or via IP:

routers:
  coolify-dashboard:
    entryPoints: [coolify_dashboard]
    rule: PathPrefix(`/`)
    service: coolify@file
    middlewares: [coolify-tweaks]
    priority: 1000

This serves your modified dashboard on http://<host>:3000.

Option B: Custom Domain

If you use a public domain, add this in addition to the router above:

Replace yourdomain.com, with your public domain.

routers:
  # HTTPS injector for your domain
  coolify-https-inject:
    entryPoints: [https]
    rule: 'Host(`coolify.yourdomain.com`) && !PathPrefix(`/app`) && !PathPrefix(`/terminal/ws`)'
    service: coolify@file
    middlewares: [coolify-tweaks]
    tls:
      certResolver: letsencrypt
    priority: 2000

What this does:

  • Matches only normal dashboard pages (skips /app and /terminal/ws, which are websockets)
  • Reuses Coolify's existing HTTPS setup with Let's Encrypt
  • Injects Coolify Tweaks without touching Coolify's built-in routers

No HTTP router is needed, Coolify's internal config already redirects HTTP → HTTPS automatically.

Restart Traefik

Open the Coolify Proxy Settings, and Restart the Proxy.

Verify

Visit either:

  • http://<host>:3000
  • https://coolify.yourdomain.com

Then check page source for your injected link:

<link
  rel="stylesheet"
  href="https://coolify-tweaks-api.techwithanirudh.com/release/latest/?asset=main.css"
/>

Custom themes via TweakCN

If you want every visitor to enjoy a specific palette, update the injected URL to include ?theme=THEME_ID (matching the ID you copied from TweakCN) and point at the main.css asset:

https://coolify-tweaks-api.techwithanirudh.com/release/latest/?theme=THEME_ID&asset=main.css

Change the <link> tag in the dynamic config to reflect the themed URL so Traefik serves the correct stylesheet.

More information about custom themes can be found in the Theming section.

Rollback

To revert:

  1. Delete /data/coolify/proxy/dynamic/coolify-tweaks.yml
  2. Remove:
ports:
  - "80:80"
  - "443:443"
  - "8080:8080"
  - "3000:3000"
command:
  - "--experimental.plugins.rewritebody.modulename=github.com/packruler/rewrite-body"
  - "--experimental.plugins.rewritebody.version=v1.2.0"
  - "--entrypoints.coolify_dashboard.address=:3000"
  1. Restart Traefik
docker compose -f /data/coolify/proxy/docker-compose.yml up -d

Troubleshooting

  • 404 on :3000: Ensure the router coolify-dashboard exists and port 3000:3000 is mapped.
  • CSS not injecting: Verify Accept-Encoding is set to identity. Gzipped HTML can't be rewritten.
  • Plugin not loading: Check Traefik logs for rewrite-body initialization errors and ensure the plugin version matches v1.2.0.

Last updated on