docker - 带有帮助 traefik 的代理 Web 界面
问题描述
我正在尝试使用分段 URL 代理 pgAdmin Web 界面。但我对此有一些问题。
当我使用以下 URL -> http://localhost/pgadmin访问浏览器时,它会将我重定向到以下 URL -> http://localhost/login?next=%2F。这是 pgAdmin 的内部路由。
我希望路由成为下一个http://localhost/pgadmin/login?next=%2F。
你能告诉我我怎样才能做到这一点。
这是我的 docker-compose 配置的示例
version: '3.7'
services:
traefik:
image: traefik:v2.2
container_name: traefik
restart: always
networks:
applications_network:
ipv4_address: 172.20.1.1
ports:
- "80:80"
- "8080:8080"
command:
- "--api.insecure=true --providers.docker"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--log.level=debug"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
pgAdmin4:
image: dpage/pgadmin4:latest
container_name: pgAdmin4
restart: always
networks:
applications_network:
ipv4_address: 172.20.2.1
ports:
- "15432:80"
environment:
PGADMIN_DEFAULT_EMAIL: "admin@test.com"
PGADMIN_DEFAULT_PASSWORD: "postgres"
labels:
- "traefik.enable=true"
- "traefik.http.routers.pgAdmin4.rule=Host(`localhost`)"
- "traefik.http.middlewares.pgAdmin4-prefix.stripprefix.prefixes=/pgadmin"
- "traefik.http.routers.pgAdmin4.middlewares=pgAdmin4-prefix"
- "traefik.http.routers.pgAdmin4.entrypoints=web"
- "traefik.http.routers.pgAdmin4.service=pgAdmin4"
- "traefik.http.services.pgAdmin4.loadbalancer.server.port=80"
networks:
applications_network:
name: applications_network
ipam:
driver: default
config:
- subnet: 172.20.0.0/16
提前致谢。
解决方案
推荐阅读
- javascript - 如何对数组内的对象进行分组
- email - 由于逗号,后缀发件人姓名部分缺失
- apache - nginx 服务器的 http_response_code 等效项是什么?
- python - 如何绘制具有不同 sin 函数值的方程?
- django - Django3:无法在 Django 中链接 html 页面
- javascript - 将嵌入发送到 discord.js 中的频道不起作用
- macos - 在电子上公证 macOS 应用程序失败,因为 - 未签名 - 我应该签署什么?
- c# - 使用 C#8.0 在 Visual Studio 中优化 switch case 后出现意外结果
- flutter - 如何解决错误:沙箱与 Podfile.lock 不同步
- c# - 使用匿名函数更改“正常”代码的可能副作用