代码之家  ›  专栏  ›  技术社区  ›  Flo

路径路由

  •  1
  • Flo  · 技术社区  · 6 年前

    我想在下面找到一个docker compose服务api.example.com/example. 因此我有以下码头工人-合成.yml

      example:
        image: example    
        labels:
                - "traefik.frontend.rule=Host:api.example.com;PathPrefixStrip:/example/"
                - "traefik.enable=true"
                - "traefik.protocol=http"
                - "traefik.frontend.entryPoints=https"
    

    我可以在这条小路下到达服务台。但是页面中的所有链接都指向错误的url api.example.com/link 而不是 api.example.com/example/link

    此外,由于路径问题,css没有正确加载。

    2 回复  |  直到 6 年前
        1
  •  0
  •   Siyu Zeeshan Akhter    6 年前

    如果我理解正确,你只想路由请求匹配 api.example.com/example/* 为了这个 example PathPrefix:/example/

    你所期望的: PathPrefixStrip

        2
  •  0
  •   DamDam    6 年前

    - "traefik.frontend.rule=Host:api.example.com;PathPrefixStrip:/example/; AddPrefix: /example"