<p>Here is my situation, I'm on kubernetes (ingress), with two docker images: one dedicated to the web and the second one to the api.</p>

<p>Under the next configuration (at the end of the message): <code>/web</code> will show the front-end that will make some calls to <code>/api</code>, <strong>all good there</strong>.</p>

<p>but <code>/</code> is a 404 since nothing is defined, I couldn't find a way to tell in the ingress config that <code>/</code> should redirect to <code>/web</code></p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: dev-ingress
  annotations:
    kubernetes.io/tls-acme: "true"
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  tls:
  - hosts:
    - demo.com
    secretName: tls-secret
  rules:
  - host: demo.com
    http: 
      paths:
      - path: /api
        backend:
          serviceName: api-app
          servicePort: 8080
      - path: /web
        backend:
          serviceName: web-app
          servicePort: 80
</code></pre>

Miguel Angel Acevedo
<p>This depends on what your frontend and backend apps expect in terms of paths. Normally the frontend will <a href="https://stackoverflow.com/questions/53148660/communication-from-pod-to-pod-on-same-node-inside-kubernetes-in-gcp">need to be able to find the backend on a certain external path</a> and in your case it sounds like your backend needs to be made available on a different path externally (<code>/api</code>) from what it works on within the cluster (<code>/</code>). You can rewrite the target for requests to the api so that <code>/api</code> will go to <code>/</code> when the request is routed to the backend:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: dev-ingress-backend
  annotations:
    kubernetes.io/tls-acme: "true"
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  tls:
  - hosts:
    - demo.com
    secretName: tls-secret
  rules:
  - host: demo.com
    http: 
      paths:
      - path: /api
        backend:
          serviceName: api-app
          servicePort: 8080
</code></pre>

<p>And you can also define a separate ingress (with a different name) for the frontend that does not rewrite the target, so that a request to <code>/web</code> will go to <code>/web</code> for it:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: dev-ingress-frontend
  annotations:
    kubernetes.io/tls-acme: "true"
spec:
  tls:
  - hosts:
    - demo.com
    secretName: tls-secret
  rules:
  - host: demo.com
    http: 
      paths:
      - path: /web
        backend:
          serviceName: web-app
          servicePort: 80
</code></pre>
