<p><strong>Background:</strong></p>
<p>I have deployed various applications into AWS/Kubernetes. Some of these applications will ASP.NET Core MVC web applications, with  Kestrel as their web server. Each of them will be running in their own pod.</p>
<p>All the applications are correctly running in their respective pods with communications to them and between them working fine.
In addition to these applications, I have also deployed an Nginx Ingress Controller that will handle traffic being sent to some of these web applications. This is where the problem is.</p>
<p><strong>Issue:</strong></p>
<p>The Kubernetes Ingress resource I am deploying is causing problems for me. When connecting to the web application through Nginx proxying it, the browser has not loaded any javascript, css, images, etc. It's just the unformatted login page of my web app.</p>
<p><strong>Note</strong> that I am not deploying the built-in Kubernetes Ingress resource. I am deploying the Nginx Custom Resource called &quot;VirtualServer&quot;, but I can only imagine the same would happen with the built-in Kubernetes Ingress resource. Below is an example of the resource I am deploying:</p>
<pre><code>kind: VirtualServer
apiVersion: k8s.nginx.org/v1
metadata: 
  name: some-name-nginx-dmz-vs
  namespace: dmz
spec: 
  host: some-host-name-that-directs-to-nginx-pod.com
  upstreams: 
  - name: com-dmz-webinterfaceclient-service-1-us
    service: com-dmz-webinterfaceclient-service
    port: 80
  - name: com-dmz-webinterfaceclient-service-2-us
    service: com-dmz-webinterfaceclient-service
    port: 443
  routes: 
  - path: /webinterfaceUIP
    action: 
      proxy: 
        upstream: com-dmz-webinterfaceclient-service-1-us
        requestHeaders: 
            pass: true
        rewritePath: /
  - path: /webinterfaceUIP2
    action: 
      proxy: 
        upstream: com-dmz-webinterfaceclient-service-2-us
        requestHeaders: 
            pass: true
        rewritePath: /
---
</code></pre>
<p>The logs from the Ingress Controller errors complaining about missing files. It seams to be looking in its own local pod, instead of the remote pod it is actually proxying the request to. Here is an example of the errors:</p>
<pre><code>2023/06/20 14:28:46 [error] 114#114: *55067 open() &quot;/etc/nginx/html/js/wtk.api.view.js&quot; failed (2: No such file or directory)
</code></pre>
<p>Are there any ideas on how I can fix this issue? Perhaps there is a way to set the content root that could for the files to be found?
The main goal here is just proxying the request, in the future, more will be added to the Nginx config, but I am not there just yet.</p>
<p><strong>As a side note:</strong></p>
<p>When I Connect directly to the pod (so not going through Nginx), it correctly loads the page with javascript, CSS, etc. Only when going through Nginx is there an issue with files not being found.</p>

Gene Smith
<p>I have determined what was missing. Adding in an additional empty path gets it to load the files as expected, CSS, javascript, image, etc:</p>
<pre><code>kind: VirtualServer
apiVersion: k8s.nginx.org/v1
metadata: 
  name: some-name-nginx-dmz-vs
  namespace: dmz
spec: 
  host: some-host-name-that-directs-to-nginx-pod.com
  upstreams: 
  - name: com-dmz-webinterfaceclient-service-1-us
    service: com-dmz-webinterfaceclient-service
    port: 80
  routes: 
  - path: /
    action: 
      proxy: 
        upstream: com-dmz-webinterfaceclient-service-1-us
        requestHeaders: 
            pass: true
        rewritePath: /
  - path: /webinterfaceUIP
    action: 
      proxy: 
        upstream: com-dmz-webinterfaceclient-service-1-us
        requestHeaders: 
            pass: true
        rewritePath: /
---
</code></pre>
