question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[🐛 Bug]: Grid crashes with Apache as reverse Proxy

See original GitHub issue

What happened?

I need to connect to our selenium grid over a secure connection (https). I couldnt figure out a way to do it with the functions that selenium delivers so i decided to use Apaches httpd as an reverse proxy.

After a couple of days (maybe a week or less) it becomes unreachable. Even without running test on that grid. Image if i connect with http://[server]:4444/ui image

Image if i connect with https://[server] image

The default log from grid and nodes says nothing. Next i am going to put the log-level to debug.

How can we reproduce the issue?

Grid setup:
podman run -d -p 4442-4444:4442-4444 \
-e "TZ=Europe/Berlin" \
--name selenium-hub [hub-image]

podman run -d -p 5555:5555 \
--shm-size 4g -e "TZ=Europe/Berlin" \
-e SE_EVENT_BUS_HOST=[server] \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
-e SE_NODE_HOST=[server] -e SE_NODE_PORT=5555 \
-e SE_NODE_SESSION_TIMEOUT="300" -e SE_NODE_MAX_SESSIONS=1 \
--name selenium-node1 [node-chrome-image]

For Apache:
{
install httpd, mod_ssl, openssl
create ssl-cert with openssl
}
Run Apache:
systemctl start httpd
nano /etc/httpd/conf.d/default-site.conf
content:{
<VirtualHost *:443>
ServerName [servername]
SSLEngine On
SSLCertificateFile [pathToFile].crt
SSLCertificateKeyFile [pathToFile].key
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://[servername]:4444/
ProxyPassReverse / http://[servername]:4444/
</VirtualHost>

<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyPass / http://[servername]:4444/
    ProxyPassReverse / http://[servername]:4444/
</VirtualHost>

}

systemctl restart httpd

Relevant log output

2022-09-09 14:11:15,466 INFO Included extra file "/etc/supervisor/conf.d/selenium-grid-hub.conf" during parsing
2022-09-09 14:11:15,469 INFO RPC interface 'supervisor' initialized
2022-09-09 14:11:15,470 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2022-09-09 14:11:15,470 INFO supervisord started with pid 8
2022-09-09 14:11:16,473 INFO spawned: 'selenium-grid-hub' with pid 10
14:11:16.809 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
14:11:16.813 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
2022-09-09 14:11:16,814 INFO success: selenium-grid-hub entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
14:11:16.904 INFO [BoundZmqEventBus.<init>] - XPUB binding to [binding to tcp://*:4442, advertising as tcp:// [ip]:4442], XSUB binding to [binding to tcp://*:4443, advertising as tcp://[ip]:4443]
14:11:16.955 INFO [UnboundZmqEventBus.<init>] - Connecting to tcp:// [ip]:4442 and tcp:// [ip]:4443
14:11:16.981 INFO [UnboundZmqEventBus.<init>] - Sockets created
14:11:17.983 INFO [UnboundZmqEventBus.<init>] - Event bus ready
14:11:18.641 INFO [Hub.execute] - Started Selenium Hub 4.4.0 (revision e5c75ed026a): http:// [ip]:4444
14:11:19.401 INFO [Node.<init>] - Binding additional locator mechanisms: name, relative, id
14:11:20.069 INFO [GridModel.setAvailability] - Switching Node 527e5556-6102-4f76-818b-dcd27454df18 (uri: http:// [servername]:5555) from DOWN to UP
14:11:20.069 INFO [LocalDistributor.add] - Added node 527e5556-6102-4f76-818b-dcd27454df18 at http:// [servername]:5555. Health check every 120s
14:11:20.073 INFO [Node.<init>] - Binding additional locator mechanisms: relative, id, name
14:11:20.207 INFO [GridModel.setAvailability] - Switching Node b73d743e-8c3a-4ea5-baad-926a89bc7a4b (uri: http:// [servername]:5556) from DOWN to UP
14:11:20.208 INFO [LocalDistributor.add] - Added node b73d743e-8c3a-4ea5-baad-926a89bc7a4b at http:// [servername]:5556. Health check every 120s

Operating System

RHEL 8

Selenium version

4.4.0

What are the browser(s) and version(s) where you see this issue?

Chrome

What are the browser driver(s) and version(s) where you see this issue?

105

Are you using Selenium Grid?

4.4.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:22 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
diemolcommented, Nov 14, 2022

Thanks for troubleshooting, @krmahadevan!

0reactions
ehesognpcommented, Nov 25, 2022

At first you have to add a SAN to your csr and cert by using your own openssl.cnf. For example openssl.cnf:

[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req

[req_distinguished_name]
...

[v3_req]
keyUsage = digitalSignature, keyEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names

[alt_names]
IP.1 = [your server ip (if you dont have a DNS)]
DNS.1 = [your server name (if you have one)]

And create your csr and cert with -config openssl.cnf -extensions v3_req

If you use a DNS in the config make sure to put -e SE_NODE_HOST=[servername] when setting up a node, else it will throw your exception again

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apache httpd is frequently crashing when sending a client cert ...
The httpd is configured as a reverse proxy server which connects with the backend server with 2-way ssl.When it tries to send a...
Read more >
Apache crash if I try to use ProxyPass on localhost to expose ...
The error is caused by your ProxyPass and ProxyPassReverse directives not having the scheme part of the URL. The correct syntax would be ......
Read more >
Interpreting web server mod_proxy_http error messages
If every proxied request is failing to connect, the backend server is not running or a network misconfiguration is blocking access. You must ......
Read more >
Account Confirmation error on ASP.NET Core web app ...
Now I have published my web app to my Ubuntu server running Apache web server using reverse proxy (https://musicstore.paul.kim). I have obtained ...
Read more >
Configuring an Apache-Server as Reverse-Proxy on Ubuntu
Create one quickly on the Cloud provider of your choice and then continue here. How to create a Server on gridscale, I will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found