使用traefik转发所有针对特定主机和后端的请求

时间:2019-12-01 15:36:03

标签: docker traefik onlyoffice

我在准系统服务器上使用Traefik(1.7)运行多个docker,其中大多数处理不同子域的请求。我喜欢它如何自动收集SSL证书,而我要做的就是在docker-compose中为服务添加某些标签。但是我遇到了一个问题,我只需要Traefik来监听特定的子域(office.example.com),然后简单地将流量“路由”到相应的容器并充当代理即可。

我有一台运行OnlyOffice容器的服务器,其中包括四个容器(在我的情况下),它们使用桥接网络将它们连接在一起。最后,一个名为Community Server的容器暴露在端口443和80上,并可以正常工作。当我使用以下标签运行 Community Server 泊坞窗时,:

      - traefik.enable=true
      - traefik.frontend.rule=Host:office.example.com
      - traefik.network=web
      - traefik.port=80
      - traefik.backend=onlyoffice-community-server
      - traefik.frontend.passHostHeader=true

在Safari上,当访问由另一个容器提供服务的端点(我假设是通过Community Server泊坞窗)时,出现此错误。

  

[已阻止]不允许位于about:blank的页面显示来自http://_/ds-vpath/5.3.2-20//web-apps/apps/documenteditor/main/index.html?_dc=5.3.2-20&lang=en-US&customer=ONLYOFFICE&frameEditorId=iframeEditor的不安全内容。

在Chrome上

  

混合内容:“ https://office.example.com/products/files/doceditor.aspx?fileid=1214”上的页面已通过HTTPS加载,但请求了不安全的资源“ http://_/ds-vpath/5.3.2-20//web-apps/apps/documenteditor/main/index.html?_dc=5.3.2-20&lang=en-US&customer=ONLYOFFICE&frameEditorId=iframeEditor”。该请求已被阻止;内容必须通过HTTPS提供。

对于我的Traefik容器,我使用以下设置:


# Force HTTPS
[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  [entryPoints.https]
  address = ":443"
    [entryPoints.https.tls]

# Let's Encrypt Configuration
[acme]
email = "admin@example.com"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
  [acme.httpChallenge]
  entryPoint = "http"

该如何解决这个问题?我是偶然的SRE / DevOps,所以请您为我的无知深表歉意。再次,我正在使用Traefik,因此我可以在同一服务器上运行具有其特定子域的其他容器(因为当前端口80和443)仅由社区服务器docker占用。

0 个答案:

没有答案
相关问题