Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin silently fails to apply rewrites for some containers #14

Open
IntermittentlyRupert opened this issue Nov 28, 2020 · 3 comments
Open
Labels
kind/bug/possible a possible bug that needs analysis before it is confirmed or fixed.

Comments

@IntermittentlyRupert
Copy link

IntermittentlyRupert commented Nov 28, 2020

This may be a duplicate of #13, but I'm not seeing the panic logs described in that issue. As with #13 I'm using CLI static config and Docker tag dynamic config.

Of the containers I've tried, these have rewrites applied correctly:

  • portainer/portainer
  • plexinc/pms-docker
  • linuxserver/jackett
  • linuxserver/deluge
  • linuxserver/nzbhydra2

and these silently fail:

  • linuxserver/sonarr
  • linuxserver/radarr
  • linuxserver/sabnzbd

Here's a minimal docker-compose.yaml where portainer will have the theme.park stylesheet injected into responses and sonarr will not:

version: "3"
services:
  traefik:
    image: traefik:2.3.4
    ports:
      - 80:80
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    command:
      - --log.level=DEBUG
      - --accesslog=true
      - --providers.docker=true
      - --pilot.token=${TOKEN}
      - --experimental.plugins.rewrite.modulename=github.com/traefik/plugin-rewritebody
      - --experimental.plugins.rewrite.version=v0.3.1
  portainer:
    image: portainer/portainer
    labels:
      - traefik.http.routers.portainer.rule=Host(`portainer.localhost`)
      - traefik.http.routers.portainer.middlewares=portainer
      - traefik.http.middlewares.portainer.plugin.rewrite.rewrites.regex=</head>
      - traefik.http.middlewares.portainer.plugin.rewrite.rewrites.replacement=<link rel="stylesheet" type="text/css" href="https://gilbn.github.io/theme.park/CSS/themes/portainer/plex.css"></head>
  sonarr:
    image: linuxserver/sonarr
    labels:
      - traefik.http.routers.sonarr.rule=Host(`sonarr.localhost`)
      - traefik.http.routers.sonarr.middlewares=sonarr
      - traefik.http.middlewares.sonarr.plugin.rewrite.rewrites.regex=</head>
      - traefik.http.middlewares.sonarr.plugin.rewrite.rewrites.replacement=<link rel="stylesheet" type="text/css" href="https://gilbn.github.io/theme.park/CSS/themes/sonarr/plex.css"></head>

Here are the associated debug logs from creating the containers then loading the landing page of each service:

@ldez ldez added the kind/bug/possible a possible bug that needs analysis before it is confirmed or fixed. label Nov 28, 2020
@mannharleen
Copy link

I am facing a similar issue with a private container. It doesnt panic, just silently doesnt apply the regex replace :(

@benjamin-feron
Copy link

The issue can be caused by gzip compression on the backend container.

@benjamin-feron
Copy link

This fork supports gzip compression on backends :

https://github.com/packruler/rewrite-body

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug/possible a possible bug that needs analysis before it is confirmed or fixed.
Projects
None yet
Development

No branches or pull requests

4 participants