<p>I have a couple of NodeJS backends running as pods in a Kubernetes setup, with Ingress-managed nginx over it.</p>

<p>These backends are API servers, and can return 400, 404, or 500 responses during normal operations. These responses would provide meaningful data to the client; besides the status code, the response has a JSON-serialized structure in the body informing about the error cause or suggesting a solution.</p>

<p>However, Ingress will intercept these error responses, and return an error page. Thus the client does not receive the information that the service has tried to provide.</p>

<p>There's a closed ticket in the kubernetes-contrib repository suggesting that it is now possible to turn off error interception: <a href="https://github.com/kubernetes/contrib/issues/897" rel="nofollow noreferrer">https://github.com/kubernetes/contrib/issues/897</a>. Being new to kubernetes/ingress, I cannot figure out how to apply this configuration in my situation.</p>

<p>For reference, this is the output of <code>kubectl get ingress &lt;ingress-name&gt;</code>: (redacted names and IPs)</p>

<pre><code>Name:             ingress-name-redacted
Namespace:        default
Address:          127.0.0.1
Default backend:  default-http-backend:80 (&lt;none&gt;)
Rules:
  Host                                Path  Backends
  ----                                ----  --------
  public.service.example.com
                                      /   service-name:80 (&lt;none&gt;)
Annotations:
  rewrite-target:         /
  service-upstream:       true
  use-port-in-redirects:  true
Events:                   &lt;none&gt;
</code></pre>

<p>I have solved this on Tectonic 1.7.9-tectonic.4.</p>

<p>In the Tectonic web UI, go to Workloads -> Config Maps and filter by namespace tectonic-system.</p>

<p>In the config maps shown, you should see one named "tectonic-custom-error".</p>

<p>Open it and go to the YAML editor.</p>

<p>In the data field you should have an entry like this:</p>

<blockquote>
  <p>custom-http-errors: '404, 500, 502, 503'</p>
</blockquote>

<p>which configures which HTTP responses will be captured and be shown with the custom Tectonic error page.</p>

<p>If you don't want some of those, just remove them, or clear them all.</p>

<p>It should take effect as soon as you save the updated config map.</p>

<p>Of course, you could to the same from the command line with <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#edit" rel="nofollow noreferrer">kubectl edit</a>:</p>

<blockquote>
  <p>$> kubectl edit cm tectonic-custom-error --namespace=tectonic-system</p>
</blockquote>

<p>Hope this helps :)</p>
