Damien-Amen
Damien-Amen

Reputation: 7502

HTTP Basic Auth in Selenium Grid

I want to implement Basic Http Authentication in Selenium Grid how do I do that? For eg: I want to send request to grid but not without authentication in the URL. I need to create something like this http://username:[email protected]:4444/wd/hub in our internal Selenium grid. How do I do that?

Upvotes: 1

Views: 2929

Answers (1)

Damien-Amen
Damien-Amen

Reputation: 7502

Ok. I was able to achieve what I needed. I installed nginx and added the selenium grid endpoint to it. Then added

auth_basic           “Grid’s Area”;
auth_basic_user_file /etc/apache2/.htpasswd; 

in the nginx.conf. That's it.

Please remember grid has multiple URI and does not have any root (In nginx terms) URI. So when you proxy let's say /grid to http://localhost:4444/grid/console all the static content cannot be served. In this case we need to proxy / to http://localhost:4001. This is because the static content is served from a different URI. In our case it's being served from /grid/resources/org/openqa/grid/images/ which is different from /grid/console.

As far as getting SSL working I follow this guide and it's super easy.

Upvotes: 4

Related Questions