Move ingress rewrite to dashboard Nginx #910
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on this discussion #897 (review) I've managed to extract the redirection logic to the Nginx configuration inside the dashboard container as well as made it generic. This is good since now, the redirect does not depend now on the specifics of the Ingress controller as well as the deployment mechanism (Helm chart).
In my previous tests the solution did not work because the redirection was including the internal port (8080)
NOTE: see location header in the following examples.
$ curl -I -H 'Cache-Control: no-cache' https://miguel-kubeapps-dev.k.dev.bitnami.net/kubeapps HTTP/2 301 server: nginx/1.15.6 date: Wed, 02 Jan 2019 21:16:01 GMT content-type: text/html content-length: 185 location: http://miguel-kubeapps-dev.k.dev.bitnami.net:8080/kubeapps/
I tried disabling the port via the directive
port_in_redirect off;
but that made the internal server_name to be shown. Adding alsoserver_name_in_redirect
did not help either.$ curl -I -H 'Cache-Control: no-cache' https://miguel-kubeapps-dev.k.dev.bitnami.net/kubeapps HTTP/2 301 server: nginx/1.15.6 date: Wed, 02 Jan 2019 21:18:43 GMT content-type: text/html content-length: 185 location: http://miguel-kubeapps-internal-dashboard/kubeapps/
Setting the redirects relative does the trick.
$ curl -I -H 'Cache-Control: no-cache' https://miguel-kubeapps-dev.k.dev.bitnami.net/kubeapps HTTP/2 301 server: nginx/1.15.6 date: Wed, 02 Jan 2019 21:14:43 GMT content-type: text/html content-length: 185 location: /kubeapps/
Refs #402