首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Docker-compose traefik PathPrefixStrip不能正常工作

Docker-compose traefik PathPrefixStrip不能正常工作
EN

Stack Overflow用户
提问于 2017-11-04 15:15:58
回答 1查看 2.6K关注 0票数 4

我有一个让我发疯的问题,请帮帮我。

我想从一个免费的无ip子域访问我的所有应用程序,所以我认为traefik可以为我做到这一点,我想像这样访问我的所有应用程序:

代码语言:javascript
复制
 mysubdomain.no-ip.com/emby
 mysubdomain.no-ip.com/pydio
 mysubdomain.no-ip.com/adminer...

这是我的docker构图:

代码语言:javascript
复制
version: "2"
services:
  db:
    image: linuxserver/mariadb
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: "test"
    labels:
      - "traefik.enable=false"
    volumes:
      - ./config/mariadb:/etc/mysql/
    ports:
      - '3306:3306'
  adminer:
    image: adminer
    restart: always
    labels:
      - "traefik.enable=true"
      - "traefik.backend=adminer"
      - "traefik.frontend.rule=PathPrefixStrip:/dbadmin"
      - "traefik.backend.port=8080"
    volumes:
      - ./config/adminer:/config
  emby:
    image: emby/embyserver:latest
    restart: always
    labels:
      - "traefik.enable=true"
      - "traefik.backend=emby"
      - "traefik.frontend.rule=PathPrefixStrip:/media"
      - "traefik.backend.port=8096"
    volumes:
      - ./config/emby:/config
  cloud:
    image: linuxserver/pydio:latest
    restart: always
    environment:
      PGID: "1000"
      PUID: "1000"
    labels:
      - "traefik.enable=true"
      - "traefik.backend=cloud"
      - "traefik.frontend.rule=PathPrefixStrip:/cloud"
      - "traefik.backend.port=443"
      - "traefik.protocol=https"
    volumes:
      - ./config/cloud:/config
      - ./data/test:/data
  organizr:
      image: lsiocommunity/organizr
      restart: always
      environment:
        PGID: "1000"
        PUID: "1000"
        TZ: "Europe/Paris"
      labels:
        - "traefik.enable=true"
        - "traefik.backend=organizr"
        - "traefik.frontend.rule=PathPrefixStrip:/"
        - "traefik.backend.port=80"
      volumes:
        - ./config/organizr:/config
        - ./data/organizr:/data
  traefik:
    image: traefik:1.3.3
    command: --web --docker --docker.domain=traefik --logLevel=DEBUG #-c /dev/null --web --docker --logLevel=INFO
    restart: always
    ports:
      - '80:80'
      - '443:443'
      - '8080:8080'
    labels:
      - "traefik.enable=false"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./traefik.toml:/traefik.toml
      - ./config/traefik/data:/data
      - ./config/traefik/sslcerts:/ssl

我的traefik.toml

代码语言:javascript
复制
# defaultEntryPoints must be at the top because it should not be in any table below
defaultEntryPoints = ["http", "https"]
InsecureSkipVerify = true

[web]
# Port for the status page
address = ":8080"

# Entrypoints, http and https
[entryPoints]

  # http should be redirected to https
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"

  # https is the default
  [entryPoints.https]
    address = ":443"
    [entryPoints.https.tls]
      [[entryPoints.https.tls.certificates]]
      CertFile = "/ssl/tls.crt"
      KeyFile = "/ssl/tls.key"
[retry]

# Enable ACME (Let's Encrypt): automatic SSL
# [acme]
# # caServer = "https://acme-staging.api.letsencrypt.org/directory"
# email = "test@gmail.com"
# storage = "acme.json" # or "traefik/acme/account" if using KV store
# entryPoint = "https"
# onDemand = false
# OnHostRule = true

[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "localhost"
watch = true
exposedbydefault = false

所以我只有一款应用程序能让你神采飞扬: emby。

Adminer semms才能正常工作,加载css和其他资产,但当我提交表单时,它会将我发送到localhost/server=db&username=test,它会将我发送到localhost/dbadmin/server=db&username=test

当我访问localhost/cloud/时,如果我打开Chrome的控制台,它会加载一个空白页面:

代码语言:javascript
复制
pydio.material.min.css Failed to load resource: the server responded with a status of 404 () pydio.boot.min.js Failed to load resource: the server responded with a status of 404 () 
cloud:18 Uncaught ReferenceError: PydioBootstrap is not defined at cloud:18 pydio.material.min.css Failed to load resource: the server responded with a status of 404 ()

实际上,它试图从localhost/plugins加载插件,而不是从localhost/cloud/plugins加载插件……我在github上看到了很多与此相关的问题,但它似乎在1.3.3版本中得到了纠正,我尝试了1.3.3,最新版本……

pydio和adminer需要支持反向代理吗?

对不起,我的英语不好。

EN

回答 1

Stack Overflow用户

发布于 2017-11-04 19:00:12

在traefik中,PathPrefixStrip和入口点do not currently work together中的重定向。因此,如果你的请求发送到http而不是https,你会得到一个错误。

my own demo中,我只是在80端口上设置了nginx来发送重定向作为短期解决方法,直到上面的问题得到解决。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47108424

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档