如何通过子路径在Traefik后面运行Matomo?

问题描述 投票:0回答:1

我正在使用Traefik(v1.7.16)作为反向代理设置docker-compose环境,并希望包含Matomo。我将Bitnami映像用于Matomo和备份数据库(MariaDB);两者latest。设置类似于Bitnami's example compose file

我按照提供的说明进行了操作,除了使用Traefik进行路由外,其他所有操作均正常。例如。我可以在localhost:<exposedPort>上运行Matomo,但不能在localhost/matomo上运行,因此子路径不起作用。

[到目前为止,我所做的是:如Matomo FAQ中所述,我将env变量MATOMO_ENABLE_PROXY_URI_HEADER=yes设置为在proxy_uri_header = 1中设置了config.ini.php(有效)。然后我为Matomo服务设置traefik标签:

labels:
  - 'traefik.backend=matomo'
  - 'traefik.docker.network=proxy_traefik'
  - 'traefik.enable=true'
  - 'traefik.frontend.headers.STSPreload=true'
  - 'traefik.frontend.headers.STSSeconds=31536000'
  - 'traefik.frontend.rule=Host:localhost; PathPrefixStrip:/matomo;'
  - 'traefik.frontend.headers.customRequestHeaders=X-Forwarded-Uri:localhost/matomo'
  - 'traefik.frontend.headers.hostsProxyHeaders=X-Forwarded-Uri'
  - 'traefik.port=80'

因此,我可以加载页面localhost/matomo,但是所有内部URL(例如图像和脚本URL)仅引用localhost,并且不包括路径/matomo

我缺少设置Traefik和Matomo的东西吗?

routing docker-compose traefik bitnami matomo
1个回答
0
投票

根据我的观察和此处的配置片段的判断,您在这里需要PathPrefix-Rule,而不是PathPrefixStrip-Rule。这样,内部URL应该在localhost / matomo之后添加,因为matomo(您的prefix)在被反向代理到后端之前不会得到stripped

© www.soinside.com 2019 - 2024. All rights reserved.