Using Nginx to handle kubernetes dashboard requests

I have 2 host.

The first one is a nignx server listening on 443 and the IP address is ip1.

The other one is a Kubernetes server and the IP address is ip2.



Kubernetes dashboard address is ip2:31117

I have another app called app2 and it’s address is ip2:30180

The dashboard and app2 are both angular project.



I want nginx server to handle requests to dashboard and app2 as below:

dashboard: https://ip1:443/dashboard to ip2:31117

App2: https://ip1:443/app2 to ip2:30180



nignx configuration shows below:

location /dashboard {

  proxy_pass=https://ip2:31117

}

location /app2 {

   proxy_pass=http://ip2:30180

}



The index.html of each app can be loaded with this configuration. But the resources included in the index.html return 404. What should I do?

Please try to add trailing slashes…

location /app2/ {
    proxy_pass http://ip2:30180/;
}

Nginx will remove the first uri part before sending it to the backend.

doc: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass