<p>I have a service running on Kubernetes available on a domain like <code>example.com</code>. I'm trying to add a path which should redirect to a wordpress blog. So I need to add a rule: everithing that goes in /blog/ should redirect to wordpress, otherwise use the main app.</p>
<p>I tried to include a regexp for the main application path to include all except /blog/</p>
<pre><code>  - host: example.com
    http:
      paths:
      - path: /^(?!blog).*$
</code></pre>
<p>but I keep getting <code>must be a valid regex</code> or if I remove the slash, it says <code>must be an absolute path</code>. I can't seem to find a way how to do that, it just keeps redirecting to my root app</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: app
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /
        backend:
          serviceName: MainAppService
          servicePort: 3010
      - path: /blog/*
        backend:
          serviceName: BlogService
          servicePort: 3020
</code></pre>

<p>Try this -</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
    kubernetes.io/ingress.class: nginx
  name: app
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /(.*)
        backend:
          serviceName: MainAppService
          servicePort: 3010
      - path: /blog/(.*)
        backend: 
          serviceName: BlogService
          servicePort: 3020
</code></pre>
<hr />
<p>I guess, this should work</p>
