Closed mattiaBox closed 2 years ago
I applied the configuration above directly to httpd.conf
as a VirtualHost
, then started Apache, it works without issue. Maybe something else is effecting the server.
My steps:
docker run --rm httpd:latest cat /usr/local/apache2/conf/httpd.conf > my-httpd.conf
(Note: httpd:latest
is pointing to 2.4 at this moment)
Modify the my-httpd.conf
, adding
<VirtualHost *:80>
ServerName localhost
ProxyRequests On
ProxyPass / http://sshwiftyserver:8182/
ProxyPassReverse / http://sshwiftyserver:8182/
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} Upgrade [NC]
RewriteRule ^/?(.*) ws://sshwiftyserver:8182/$1 [P,L]
</VirtualHost>
Enable mod_proxy
, mod_http_proxy
and mod_rewrite
docker run --rm --name my-apache-app -p 8080:80 -v "$PWD/my-httpd.conf":/usr/local/apache2/conf/httpd.conf httpd:latest
Open http://localhost
, confirm that the websocket connection works.
Thank you, Nirui!
Actually, I use port forwarding for reaching my Apache instance from the Internet, but it looks like my router is dropping these WebSocket packages (this morning I checked with a tcpdump)... I don't know why, but obviously it's not Sshwifty fault ;) I was so confident on this solution's feasability and on my network configuration that I didn't even check it.
I'm so sorry to have bothered you. Thank you again for your prompt response.
Well ... It took me over 7 hours to pull that Apache image due to my poor network, so it's not exactly a prompt respond LOL.
About the Port Forwarding, hmm... that's weird. A basic relay (iptables for example) or NAT should just re-transmit the TCP payload as-is without filtering the content.
I don't have any deep experience with router configurations, so I'm afraid I could only make guesses. Maybe check your firewall setting etc, see if there is anything HTTP related?
7 hours is quite a bit... again, I'm sorry.
It seems an issue with the firewall packet inspector, but I think is not useful to talk here about my personal network infrastructure. So, thank you again for your kind response. I'm gonna close this issue since is not Sshwifty related.
Bye
It's fine actually, it was the machine spending the night downloading that. I was just explaining why it took me 12 hours to post a respond -- because I wanted to take look the setting before offer any suggestion.
Anyway, if the packet inspector is indeed the cause, then HTTPS maybe worth a try. Good luck! :D
Hi. Thank you for having shared your amazing work!
I'm facing an error trying to implement Sshwifty behind a proxy using Apache 2.4.
The error client side is:
Unable to connect to the Sshwifty backend server: WebSocket Error (1006)
The error in the log of my docker installation is:
Sshwifty > Server (0.0.0.0:8182) > Client (192.168.1.100:35426): Request ended with error: /sshwifty/socket: HTTP Error (400): websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header
This is my Apache configuration:
The headers requested from the client (F12) are as expected:
I cannot understand what's going on... can someone help me?
Thank you