HAProxy - 从域前缀重写路径

时间:2016-11-17 20:00:11

标签: url-rewriting dns haproxy prefix

我想从域前缀重写路径。有两种情况:

  1. https://prefix.domain.com/path - > https://prefix.domain.com/path/#/prefix
  2. https://prefix.domain.com/path1 - > https://prefix.domain.com/path1/#/prefix/home
  3. 我尝试使用此配置重写路径。但是我无法在reqirep中从域中提取前缀。我认为reqrep仅适用于GET / XXXX HTTP / 1.1字符串,而不是完整的URL。

        acl match path_end -i /path
        acl match1 path_end -i /path1
        use_backend traefik_path if match
        use_backend traefik_path1 if match1
        default_backend traefik_path
    
        backend traefik_path
          reqirep ^([^\ ]*\ /)path \1/path/#/??
          balance roundrobin
          server traefik 127.0.0.1:8000 check
        backend traefik_path1
          reqirep ^([^\ ]*\ /)path1 \1/path1/#/??/home
          balance roundrobin
          server traefik 127.0.0.1:8000 check
    

0 个答案:

没有答案