-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make UI URL links relative #692
Make UI URL links relative #692
Conversation
Codecov Report
@@ Coverage Diff @@
## master #692 +/- ##
=======================================
Coverage 65.93% 65.93%
=======================================
Files 14 14
Lines 1374 1374
Branches 214 214
=======================================
Hits 906 906
Misses 421 421
Partials 47 47 Continue to review full report at Codecov.
|
a09f50b
to
6e50599
Compare
6e50599
to
06fab82
Compare
Rebased against latest master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 let's merge this
@cgoldberg Im facing this issue even now. |
@kasturichavan |
Did you find any solution for this? We would like to expose locust on different paths in k8s using the nginx ingress rewrite annotation feature. Looks like static files are still served from wrong path. |
@karol-brejna-i does this PR make url-prefix configurable for the web-ui... did not see any such parameter in locust documentation.. not sure if I am missing something. if you can help please. |
If anyone comes here looking for the annotations to make this work with k8s ingress-nginx then here is what I used: - apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/use-regex: "true"
name: locust
namespace: locust
spec:
ingressClassName: nginx
rules:
- http:
paths:
- backend:
service:
name: locust-master
port:
number: 8089
path: /locust(/|$)(.*)
pathType: Prefix
This is based on https://kubernetes.github.io/ingress-nginx/examples/rewrite/ |
Fixes #149
When using proxy or exposing Locust UI in Kubernetes (via ingress) the URLs get prefixed (for example, served under http://domain.com/locust instead of http://domain.com).
On the other hand, links in html template and JS (rest calls) are absolute (starting with '/') which makes the UI inoperable.
This PR makes the links relative - they work fine both with and without a prefix.
To validate:
When looking at HTML page sources you should see
<link rel="stylesheet" type="text/css" href="./static/style.css?v=0.8" media="screen">
somewhere at the beginning of the doc.Verify if the UI works: starting, stopping the tests, browsing the stats produce valid rest calls.
(Be aware of browser caching; sometimes "old" HTML and JS are served.)