Score:0

Why websocket traffic is not redirected in Apache2?

vn flag

A web browser uses the following command to connect to server 1:

var websocket = new WebSocket("wss://mywebsite.com:6789/);

server 1 should redirect all the websocket traffic to server 2 which has the IP address of 10.8.0.1. Therefore, on server 1 the Apache config file has the following lines:

<VirtualHost *:6789>

    SSLEngine on
    SSLCertificateFile "/home/ubuntu/ssl/public.key"
    SSLCertificateKeyFile "/home/ubuntu/ssl/private.key"

    <Location "/">
       ProxyPass "wss://10.8.0.1:6789"
       ProxyPassReverse "wss://10.8.0.1:6789"
    </Location>

</VirtualHost>
                

I monitored the network traffic on server 2 with sudo tshark -i 1 -f "tcp port 6789". I see no incoming traffic on port 6789 of server 2. Why?

in flag
Which version of Ubuntu are you running? Is it Ubuntu Server or Desktop? Have you checked that `ufw` is not blocking port 6789? Have you confirmed that it's being correctly directed to Apache? Lots of other questions can be asked, but these are the first items that can lead to a solution ...
Admia avatar
vn flag
`ufw` is not blocking. I run ubuntu 20.04. Can you elaborate on this: Have you confirmed that it's being correctly directed to Apache? Should I do anything to direct websocket traffic to apache?
in flag
A `sudo ufw allow 6789/tcp` will generally work, but having the UFW rules for Apache set to include 6789/tcp (along with 80 and 443) is generally a good practice to get into. It ensures rules are configured and controlled in just one place. You can check the config for Apache in `/etc/ufw/applications.d/`. Make sure `6789/tcp` is appended to `ports=`, then `ufw app update "Apache Full"` (or whichever Apache config you're using with the uncomplicated firewall).
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.