testkube: Unable to use non-root path for dashboard
Describe the bug
The testkube dashboard is not available when the ingress path is not /
To Reproduce Steps to reproduce the behavior: Using the testkube Helm Chart
- Set values
testkube-dashboard:
enabled: true
ingress:
enabled: true
hosts:
- myhost.example.com
path: /test-svc
- Deploy the chart
- Access http://myhost.example.com/test-svc
- Observe blank page. The app is loaded, but receives a 404 attempting to load
env-config.js(and other files) and therefore does not recognise the non-root path.
Expected behavior Expected app to load, as it does when configured for the domain root path
Version / Cluster
- Which testkube version? 1.8.8
- What Kubernetes cluster? EKS
- What Kubernetes version? 1.22
Screenshots

Additional context
This issue was raised previously https://github.com/kubeshop/testkube/issues/2362 and code was added, but I don’t see how the code can function since it sets values in env-config.js which the app attempts to download from the root.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 23 (13 by maintainers)
Commits related to this issue
- fix: allow non-root path for the static server Resolves: kubeshop/testkube#2952 — committed to kubeshop/testkube-dashboard by rangoo94 a year ago
- fix: allow non-root path for the dashboard (#761) * fix: allow non-root path for the static server * fixup allow non-privileged user to run the Docker container Relates to: kubeshop/testkube#2952 — committed to kubeshop/testkube-dashboard by rangoo94 a year ago
- Release/v1.13.0 (#763) * feat: allow providing initial state for stores (#712) * Triggers multi-view layout (#700) * triggers multi view ui * adjusted creation form and validation * delet... — committed to kubeshop/testkube-dashboard by vsukhin a year ago
- fix: Avoid absolute "/" path for files, to make <base href> working Relates to: kubeshop/testkube#2952 — committed to kubeshop/testkube-dashboard by rangoo94 a year ago
- fix: Avoid absolute "/" path for files, to make <base href> working (#766) Relates to: kubeshop/testkube#2952 — committed to kubeshop/testkube-dashboard by rangoo94 a year ago
- fix: always use / on end of <base href> Relates to: kubeshop/testkube#2952 — committed to kubeshop/testkube-dashboard by rangoo94 a year ago
- fix: always use / on end of <base href> (#792) Relates to: kubeshop/testkube#2952 — committed to kubeshop/testkube-dashboard by rangoo94 a year ago
This is the only method working for us too and it looks like this is the only method that will work.
This would be due to the configuration of nginx: https://github.com/kubeshop/testkube-dashboard/blob/develop/nginx/nginx.conf#L30
So despite React now constructing URLs correctly, when Ingress forwards a request to the backend nginx server hosting the React app we get:
Scenario 1: URL rewrite
user request:
REACT_APP_ROOT_ROUTE=/my/pathresults in<base href="/my/path/">due to https://github.com/kubeshop/testkube-dashboard/blob/develop/scripts/inject-base-href.shResult: This works because nginx serves the Single Page App from the root without any visibility to the browser URL. That’s fine, but it’s inconvenient to configure both the path and the env var.
Scenario 2: No URL rewrite: What seems like it should work, but doesn’t
REACT_APP_ROOT_ROUTE=/my/pathresults in<base href="/my/path/">due to https://github.com/kubeshop/testkube-dashboard/blob/develop/scripts/inject-base-href.shResult: Blank white page, because nginx is configured to serve
index.htmlfor any requests that don’t match an existing file:So the requests for any URL except
/my/path/index.htmlalso receivesindex.htmlas the response. So none of the static assets are served.To work around this by modifying
nginx.confis non-trivial. You can’t just changelocation / {because you’d need a rewrite for the path as well as the try_files… it’s beyond my nginx-fu.The hotfix has been released in the newest version, you may run
testkube upgradecommand to install the latest version. Sorry for the inconvenience, this time I have verified it twice 👍The fix has landed in
v1.13.0. You may runtestkube upgradecommand to install the latest version.Hi! Thanks for your patience.
The new Testkube version has been released, and it will always keep trailing
/to the<base href>, which should solve the issue withingresswithout trailing slash.Sure I understand your response, but if ‘/’ is added to the ingress then
/my/pathwill not work and users must specify/my/path/in order to get a response, which is not a great experience.@rangoo94 it’s the absolute links in the html which defeat the
base hrefHi @Carlosgova! Sorry, just tested it once again and it’s actually not working. I should fix it shortly though 👍
Hi @djonesz! Unfortunately, we didn’t touch it yet. We will discuss it today to provide some estimations.
Looking at the UI code, this bug may be solved by adding appropriate
<base>tag for the front-end should solve all/most of the problems.