[🚀 Feature]: Subpath parameter for subpath ingress configurations
Feature and motivation
Adding parameter for subpath configuration so inside container application can work on different path than root.
I've tested rewrite rules on ingress and they do not work correctly.
Usage example
Currently application works on http://localhost:4444 inside of the container, unfortunately in ingress implementation with reverse-proxy application will not respond correctly to ingress configuration where path is configured different than "/" New parameter would allow to change base URL of the application to work on http://localhost/selenium:4444 which will allow correct communication with ingress.
@med502, thank you for creating this issue. We will troubleshoot it as soon as we can.
Info for maintainers
Triage this issue by using labels.
If information is missing, add a helpful comment and then I-issue-template label.
If the issue is a question, add the I-question label.
If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable G-* label, and it will provide the correct link and auto-close the
issue.
After troubleshooting the issue, please add the R-awaiting answer label.
Thank you!
Which app do you mean? The Grid UI?
Which app do you mean? The Grid UI?
This is regarding hub component. I am implementing cluster of hub with few worker nodes for our tester chapter.
Still a bit lost. Can you describe where you use the URL for the app you mentioned?

Using diagram above HUB component is accessible over kubernetes ingress wtih nginx class. Whenever I use subpath in ingress configuration so application will be on mydomain.com/selenium application is not accessible I can only use root path so I can set selenium to work only on mydomain.com
In that case various application require additional parameter to work on subpath which is different than root path of the URL example for grafana https://grafana.com/tutorials/run-grafana-behind-a-proxy/
I am still not understanding. Do you mean the user interface of the Grid, where you can see the running sessions and node stereotypes? Or do you mean the URL endpoint where you start sessions? Both live inside the Hub.
Both interface and checking status with command below
curl -X GET https://mydomain.com/selenium/status
I see. It should actually work. Can you share the work you have done so we can try it as well? Maybe in a GitHub repository with instructions.
I've deployed selenium from helm chart from this link
https://github.com/pedrodotmc/docker-selenium/tree/selenium-grid-helm-chart/chart/selenium-grid
and then I've updated ingress to look like this
apiVersion: v1
items:
- apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/publicEndpoints: ;[{"address":[""]."port":443,"protocol":"HTTPS","serviceName":"selenium:selenium-hub","ingressName":"selenium:selenium-ingress","hostname":"mydomain.com"."path":"/selenium","allNodes":false}]'
kubernetes.io/ingress.classs: nginx
nginx.ingress.kubernetes.io/add-base-url: "true"
meta.helm.sh/release-name: selenium-grid
meta.helm.sh/release-namespace: selenium
name: slenium-ingress
namespace: selenium
spec:
rules:
- host: mydomain.com
http:
paths:
- backend:
serviceName: selenium-hub
servicePort: 4444
path: /selenium
pathType: Prefix
tls:
- host:
- mydomain.com
secretName: mydomain-secret
Problem occurs as our nginx ingress is behind AWS load balancer and reverse proxy. I've tried to add rewrite /$2 annotation but that deos not work as well
As discussed on slack, Even for me it's the case..
Any update on this?
If there were updates, they would have been posted here.
Sorry to say but it seems the update is left from your end, @med502 have posted reproducing steps and plus this is case for docker based hub too, is there any flag which can run hub to subpath/context-path instead of root context?
@diemol can you help me with what setting it will work as below URL : curl -X GET https://mydomain.com/selenium/ui/
If someone wants to work on this, there are at least three places where changes need to be done:
There are some lines where a prefix/subpath is added, ideally one should be able to configure this subpath in the router configuration.
Probably the UI needs to be tested properly to double check it is still working. In addition, double check that requests reach the Node and other components, running a few tests should show if this works well.
@diemol but for /ui it needs to be done at this point https://github.com/SeleniumHQ/selenium/blob/01bf373e006564840ef82747ef0d437b8f3b9665/java/src/org/openqa/selenium/grid/web/GridUiRoute.java#L51?
@yashcho - Yes. Thats because the routing for the UI part is internally handled by GridUiRoute
It could be done there or at the server startup, however the configuration of the UI needs to be tweaked to work under subpaths. Not sure how that can be done, would need to research that.
What do you mean by server startup?
What do you mean by server startup?
The three links I shared above.
@diemol I got some basic hard coding to work for the UI endpoints... but am wondering as to what should be the expected behaviour for the new session endpoint as well as the endpoint that deals with existing session ?
For e.g., a test case would basically be doing a POST against http://ip:port/session which would reach a reverse proxy such as nginx. Now lets say nginx has been configured to route all traffic on 4444 port to /selenium sub-path which is where the Hub|Router is listening to. So this would mean that the URI that reaches the hub's handlers would now contain /selenium/session. I guess this means that we would need to ensure that all the /session && /session/{sessionId} endpoints also need to support the notion of sub-path no ?
@krmahadevan not really, /wd/hub is a prefix that already works. So no need to ensure all that apart of running some tests.
What is the method to test the changes, I mean how to verify if the changes are working?
For your information I am using GitPod to work on the changes.
https://github.com/SeleniumHQ/selenium#common-build-targets is a good start for it.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.