How to change the websocket port for the Selenium VNC? - selenium

I'm running the Selenium on Kubernetes, behind the Ingress-Nginx controller.
One thing I noticed is when I try to see the live VNC through the Selenium Grid web, the browser keeps trying to connect the 4444 port of the Selenium grid server for the WebSocket connection.
Is there a way to make it point the 80 port instead?
I already tried to switch the port number for the Selenium router to 80 (SE_ROUTER_PORT to 80), but apparently, the WebSocket is still not working.
This is what I'm seeing on the browser console:
I already confirmed the functionality itself with the kube-proxy localhost proxying.
Thank you very much.

Related

Can't access Vue3 app on server using domain name, but works with IP

I have a Digital Ocean droplet running two Docker containers, one that is a Vue3 app which I'm having issues with, and a Django server that I'm not having issues with.
vue-cli-service serve --mode production --host 0.0.0.0 --public http://XXX.YYY.ZZZ.XXX:8080
If I go in Chrome and type www.websitename.com
This site can’t be reached websitename.com refused to connect.
If I go in Chrome and directly type the IP and the port I can see the website load. Is this a DNS resolution issue? I really don't think so, here's why:
If I go in Chrome and type http://websitename.com:8000/admin
I see a Django administration site. This means that I have no problem with Django, only with Vue3.
I tried setting --host 0.0.0.0, I tried adding --public with the website name and with the IP directly.
Also nmap seems to show everything working fine
nmap -F websitename.com <---- No issue with DNS resolution
Starting Nmap 7.80 ( https://nmap.org ) at 2022-07-26 20:14 PDT
Nmap scan report for XXX.YYYY.ZZZ.XXX <---- Correct IP
Host is up (0.090s latency).
Not shown: 92 closed ports
PORT STATE SERVICE
22/tcp open ssh
25/tcp filtered smtp
111/tcp filtered rpcbind
135/tcp filtered msrpc
139/tcp filtered netbios-ssn
445/tcp filtered microsoft-ds
8000/tcp open http-alt <---- Django
8080/tcp open http-proxy <---- Vue3
If you do not provide a port in Chrome - it will default to port 80. But your Vue3 Docker is running on port 8080. Therefore you have to either provide this port when you type the URL in Chrome - or you must run your Docker on port 80.
You are providing port 8000 for the Django administration site - do the same (with port 8080) for your Vue3 application.

Jmeter - Recording test cases through port 8080 - timeout error

I have created below setup in Jmeter to run recorded test cases.
Added Thread Group to test plan.
Added HTTP Request Defaults to thread group (in path section i have given url as 'http://localhost:8044')
note: 'http://localhost:8044' is the url which i want to launch on firefox.
Added Recording controller to thread group
In workbench
Added HTTP(S) Test Script Recorder (In port section i have given 8080 as port no)
Now when I recorded test cases and played the test plan- test samples are failing with the following error.
Error:
Response code: Non HTTP response code: java.net.ConnectException
Response message: Non HTTP response message: Connection timed out: connect
Running this setup in virtual machine.I have tried with some other ports like 7070,8055,8044 but still getting same error.
Not sure where the issue is. Can any one please help me on this.
You have to setup the proxy in the browser also with same port that you mentioned in Test Script Recorder
8044 port - is in which server is listening (HTTP Sampler port)
8080 port - is in which proxy server is listening (Test Script Recorder port)
Both are different. we need to configure proxy server port (which we specified in Test Script Recorder) in the browser setting also.
Note: If 8080 is already taken by some other process in your machine, try different port.
Setting up proxy in Firefox:
Options -> Advanced -> Network tab -> Settings button related to Connection -> enter port in Manual Proxy Configuration).
Follow the steps mentioned here:
https://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf
Add Thread Group to test plan.
Add Transaction controller to thread group
Add HTTP(S)Test Script Recorder to workbench
In HTTP(S)Test Script Recorder set global setting port to 8080,in target controller select the transaction controller in which you want to record the test click on start button before clicking start button you have to set proxy to record the script to do that go to firefox-option-Advanced-Network-Connection click on setting- select manual proxy config-in HTTP proxy give localhost and port 8080 and check the use this proxy server for all protocols .
This works for me.Check if 8080 port used by another process to do so in cmd type netstat -an
The issue is resolved. Recording was not happening because of this.
Firefox default setting will bypass "localhost, 127.0.0.1" from proxy so your JMeter still not able to record it. You have to empty the "No Proxy for" field, by removing the "localhost, 127.0.0.1". Hope this will help.
I removed localhost, 127.0.0.1 from the no proxy field in firefox.
Got the fix from the link https://stackoverflow.com/a/37776363/4715839
Thanks all for sharing your comments.

Why is connection refused by Vagrant box in Windows 10?

I've been having problems with Vagrant since upgrading to Windows 10. At first I had the "host-only adapter" problem that many people seem to be experiencing. This was fixed by updating VirtualBox to the latest version, and my Vagrant box now seems to provision and start ok, and I can SSH into it, but can't connect via HTTP. If I try to access it from a browser, I get "Unable to connect". If I try curling it, I get the message:
Failed to connect to test.dev port 80: Connection refused
I've checked and Apache seems to be running on the VM (and in fact if I SSH into the VM and then run curl 127.0.0.1 the expected homepage is returned). At this point I've drawn a blank: I don't know whether the problem is in Windows or the VM's settings. Any help would be greatly appreciated!
(For what it's worth, I'm using VirtualBox 5.0.15r105158 + Vagrant 1.8.1)
Update: it turns out that the VM is accessible from test.dev:8888 in the browser, so I'm guessing the problem is to do with port-forwarding? I don't know much about this though, so have no idea why this wouldn't be working in Windows 10. (In case it helps, my Vagrantfile contains the line config.vm.network :forwarded_port, guest: 80, host: 8888)
I think you have answered all by yourself - you might read the vagrant doc on port forwarding
Vagrant forwarded ports allow you to access a port on your host
machine and have all data forwarded to a port on the guest machine,
over either TCP or UDP.
For example: If the guest machine is running a web server listening on
port 80, you can make a forwarded port mapping to port 8888 (or
anything) on your host machine. You can then open your browser to
localhost:8888 and browse the website, while all actual network data
is being sent to the guest.
when you add the line config.vm.network :forwarded_port, guest: 80, host: 8888 to your vagrant file, the VM (i.e. call also guest or guest VM) )will forward all the stream going on its port 80 to the host (in you case the windows machine) on port 8888, so in this case when you point your browser to listen on port 8888 you can see the website running from the VM
When you are within the VM though, you point to the expected 80 port.
one additional point (hope not to confuse you): in your Vagrantfile, did you define something for networking ? (param config.vm.network) you probably define a fixed IP (since you point to test.dev) in such case you dont need to do port forwarding, you can correctly access http://test.dev (on default port 80) as nothing else is bounding to this port. Port forwarding is really useful when you use public network and you do not define a fix IP to the guest VM, so in this case you access the site running on the VM from localhost/127.0.0.1, and as such you cannot just point to port 80, as something on your host can already be running.

How to restrict access to Selenium from ethernet?

I have Selenium server listening to 4444 port. How can I make selenium listen to connection only from localhost but not from the whole internet?
Or is there any other way to secure Selenium?
My selenium server is run with such parameters:
java -jar selenium-server-standalone-2.44.0.jar -p 4444
This is something that is out of the scope of the application itself, you could place your Selenium server behind a reverse proxy (e.g., Apache Web Server) and just allow local connections to it or just configure your OS's firewall.

SailsJS on production - Error: listen EADDRINUSE

I have a VPS server with CentOS and Apache server.
But I want to run my node.js applications too. I am using sails.js
This sails application is trying to listen to port 80 of specified host.
Here is error (after sails lift running):
debug: Starting server in /var/www/user/data/nodeprojects/projectname...
info - socket.io started
debug: Restricting access to host: projectname.com
warn - error raised: Error: listen EADDRINUSE
warn:
warn: Server doesn't seem to be starting.
warn: Perhaps something else is already running on port 80 with hostname projectname.com?
What is the problem? Can I run both apache and nodejs servers on one server with one port (80)?
No, you cannot.
When a server process opens a TCP port to answer requests, it has exclusive use of that port. So, you cannot run both SailsJS and Apache servers on the same port.
Having said that, you can do lots of interesting things with Apache, such as proxying specific requests to other servers running on different ports.
A typical setup would have Apache on port 80 and SailsJS on port 8000 (or some other available port) where Apache would forward requests to certain URLs to SailsJS and then forward the reply from SailsJS back to the browser.
See either configuring Apache on Mountain Lion proxying to Node.js or http://thatextramile.be/blog/2012/01/hosting-a-node-js-site-through-apache for example implementations of this approach.
you cannot use same port for different application. NodeJS can use any open port. What you need todo is port forwarding for your app. :)