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

Traefik? #42

Closed
Mbarmem opened this issue Apr 19, 2020 · 20 comments
Closed

Traefik? #42

Mbarmem opened this issue Apr 19, 2020 · 20 comments
Labels
help wanted Extra attention is needed

Comments

@Mbarmem
Copy link

Mbarmem commented Apr 19, 2020

Hi,
Is their any way to install the theme via Traefik reverse proxy?

I am asking since i see guides for Apache and Caddy.

@GilbN
Copy link
Collaborator

GilbN commented Apr 19, 2020

Hi. Sorry I haven't found a way to do subfiltering with træfik yet. I would ask the dvs if they have some similar function. Or use the better web server..nginx :P

@Mbarmem Mbarmem closed this as completed Apr 25, 2020
@GilbN
Copy link
Collaborator

GilbN commented Sep 11, 2020

@Mbarmem see if you can get this working https://pilot.traefik.io/plugins/276809785011077632/rewrite-body

@GilbN GilbN reopened this Sep 11, 2020
@GilbN GilbN pinned this issue Oct 17, 2020
@GilbN GilbN added the help wanted Extra attention is needed label Oct 17, 2020
@GilbN
Copy link
Collaborator

GilbN commented Oct 21, 2020

Note to self: Doesn't work with the current implementation of the traefik plugin.
traefik/plugin-rewritebody#12

@IntermittentlyRupert
Copy link

IntermittentlyRupert commented Nov 28, 2020

It seems that traefik/plugin-rewritebody#12 no longer causes issues with injecting styles. However traefik/plugin-rewritebody#13 causes the plugin to fail for some containers.

(ETA: I've just spent a bit more time playing around with this minimal example and I'm not getting the panic log message like I am in my actual setup. I've raised traefik/plugin-rewritebody#14 to see if they think it's a separate issue.)

Of the containers I've tried, these work:

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

and these don't:

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

Here's a minimal example for Portainer using the Docker config provider:

version: "3"
services:
  traefik:
    image: traefik
    ports:
      - 80:80
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    command:
      - --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/${THEME}.css"></head>

@GilbN
Copy link
Collaborator

GilbN commented Jan 3, 2021

@IntermittentlyRupert btw there are some docker mods you can now use to apply the themes with. (Only for linuxserver) https://github.com/gilbN/theme.park/wiki/Setup#docker-mods

@IntermittentlyRupert
Copy link

@GilbN Oh, that's awesome! Between the Docker mods and the Traefik rewrite plugin, the only app I use that I can't inject styles for is Organizr, and that supports custom CSS.

@GilbN
Copy link
Collaborator

GilbN commented Jan 11, 2021

@GilbN Oh, that's awesome! Between the Docker mods and the Traefik rewrite plugin, the only app I use that I can't inject styles for is Organizr, and that supports custom CSS.

Yeah. I didnt crate any mods for apps that support custom css. And organizr has my themes in the marketplace too. 👍🏻

@beloso
Copy link

beloso commented Feb 11, 2021

Sorry for highjacking this. But do you have a rewrite example for Qbittorrent?

I was able to get the themes to working with Stylus + Middleware for the headers needed to hide.
I'd like to keep it all within the Middleswares

I tried this one:

  middlewares:
    qbittheme:
      plugin:
        rewritebody:
          rewrites:
            regex: </noscript>
            replacement: <link rel='stylesheet' type='text/css' href='https://gilbn.github.io/theme.park/CSS/themes/plex/organizr-dark.css'></noscript>

But no luck. Any help would be appreciated

For anyone wondering how to hide the headers with traefik, this is what I got.

http:
  middlewares:
    qbitheaders:
      headers:
        customRequestHeaders:
          X-Webkit-CSP: ""
          content-security-policy: ""
          X-Frame-Options: ""
        customResponseHeaders:
          X-Webkit-CSP: ""
          content-security-policy: ""
          X-Frame-Options: ""

@IntermittentlyRupert
Copy link

@beloso If the rest of your Traefik config is working, my guess would be that this is probably caused by one of the plugin-rewritebody bugs from my earlier comment.

Your best bet would probably be to contribute a Docker Mod for Qbittorrent and use that. They're a lot more stable and easier to work with than trying to get plugin-rewritebody to play nice.

@beloso
Copy link

beloso commented Feb 12, 2021

I researched a bit on doing a Mod, but I can't seem to find the default index.html for qbittorrent. It might be because I am not that well versed in how this is set up. If someone can point me in the right direction, I'd be happy to try my hand at this.

@GilbN
Copy link
Collaborator

GilbN commented Feb 13, 2021

Yeah I didn't find the correct html file either.

@IntermittentlyRupert
Copy link

I've opened #148 for this and added some additional notes.

@packruler
Copy link

FYI I recently released a plugin that began as a fork of traefik/plugin-rewritebody. It is now publicly available here: packruler/rewrite-body.

Check out the Examples page in the wiki for a quick example for implementation of the plugin.

@GilbN
Copy link
Collaborator

GilbN commented Apr 17, 2022

Awesome! Thanks for creating this!

@beloso
Copy link

beloso commented Apr 17, 2022

I found that plug-in yesterday. I’ll give it a go this week.

@GilbN GilbN mentioned this issue Apr 17, 2022
@agneevX
Copy link

agneevX commented Apr 17, 2022

@packruler Great plugin! Can you tell me how the dynamic env var works? Thanks.

@packruler
Copy link

Yeah if you're using docker you can add -e THEME=nord to your docker run traefik command. I'm not sure exactly how to set it up in other environments at the moment but here's some more info on Linux Environment Variables.

@packruler
Copy link

Actually I just found a better way to do it! At the top of your dynamic yaml definition you can add # {{ $theme := "nord" }} and then replace the {{ env THEME }} in the example with {{ $theme }}. I'm going to update the wiki in project shortly and may have more things building on that 😁

@GilbN
Copy link
Collaborator

GilbN commented Apr 22, 2022

I guess we can close this now? @packruler added some instructions here too: https://docs.theme-park.dev/setup/#traefik

@packruler
Copy link

I have not heard of any issues yet.

@GilbN GilbN closed this as completed Apr 22, 2022
@GilbN GilbN unpinned this issue Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants