<p>I try to use  haproxy as load balance and  haproxy-ingress as ingress controller in k8s. </p>

<p>my  load balance config:</p>

<pre><code>frontend MyFrontend_80
    bind    *:80
    bind    *:443
    mode    tcp
    default_backend         TransparentBack_https

backend TransparentBack_https
        mode                            tcp
        balance roundrobin
        option ssl-hello-chk
        server                  MyWebServer1 10.5.5.53
        server                  MyWebServer2 10.5.5.54
        server                  MyWebServer3 10.5.5.55
</code></pre>

<p>Ingress file:</p>

<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: li
  namespace: li
  annotations:
    # add an annotation indicating the issuer to use.
    cert-manager.io/cluster-issuer: "letsencrypt-staging"
    #haproxy.org/forwarded-for: true
    kubernetes.io/ingress.class: haproxy
    ingress.kubernetes.io/ssl-redirect: "true"
spec:
  rules:
  - host: a.b.c
    http:
      paths:
      - path: /storage
        backend:
          serviceName: li-frontend
          servicePort: 80
  tls:
  - hosts:
    - a.b.c
    secretName: longhorn-ui-tls
</code></pre>

<p>li-frontend is a dashboard ui service.</p>

<p>All is ok when I set the path field to blank in my ingress. and page is not normal when  the path field seted to /storage or any non blank value.</p>

<p>I find some link not get correct position, e.g.</p>

<pre><code>requst             correct value
/main.js           /storage/main.js
</code></pre>

<p>I found  this in nginx-ingress:</p>

<pre><code>#nginx.ingress.kubernetes.io/configuration-snippet: |
#rewrite ^/main(.*)$ /storage/main$1 redirect;
</code></pre>

<p>Does haproxy-ingress has same function?
I try these, but no effect:</p>

<pre><code>ingress.kubernetes.io/app-root: /storage
ingress.kubernetes.io/rewrite-target: /storage
</code></pre>

<p>In addition, I use rewrite in nginx-ingress, but it don't work on websocket.</p>

<p>Sorry for my pool english.</p>

Yang Jie
<p>for HAProxy:</p>
<p>you have to use haproxy annotation:</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: web-ingress
  namespace: default
  annotations:
    # replace all paths with /
    haproxy.org/path-rewrite: &quot;/&quot;

    # remove the prefix /foo... &quot;/bar?q=1&quot; into &quot;/foo/bar?q=1&quot;
    haproxy.org/path-rewrite: (.*) /foo\1

    # add the suffix /foo ... &quot;/bar?q=1&quot; into &quot;/bar/foo?q=1&quot;
    haproxy.org/path-rewrite: ([^?]*)(\?(.*))? \1/foo\2

    # strip /foo ... &quot;/foo/bar?q=1&quot; into &quot;/bar?q=1&quot;
    haproxy.org/path-rewrite: /foo/(.*) /\1
spec:
  # ingress specification...

</code></pre>
<p>Ref: =&gt; <a href="https://www.haproxy.com/documentation/kubernetes/1.4.5/configuration/ingress/" rel="noreferrer">https://www.haproxy.com/documentation/kubernetes/1.4.5/configuration/ingress/</a></p>
