Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

173
Views
Able to redirect https to http but not able to redirect wss to ws

I am working with web sockets. In apache I am able to redirect from https to http by doing below setting in configuration file:

      <VirtualHost *:443>
      # Common SSL Config
      ServerName ec2-13-52-248-221.us-west-1.compute.amazonaws.com
      SSLEngine on
      # wss redirects to working ws protocol

            SSLCertificateFile      /etc/ssl/certs/apache-selfsigned.crt
            SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
            ProxyPass "/"  "http://ec2-13-52-248-221.us-west-1.compute.amazonaws.com" retry=0 keepalive=On

      </VirtualHost>

But same configuration(As Above) I change as follow

     <VirtualHost *:443>
      # Common SSL Config
      ServerName ec2-13-52-248-221.us-west-1.compute.amazonaws.com
      SSLEngine on
      # wss redirects to working ws protocol

            SSLCertificateFile      /etc/ssl/certs/apache-selfsigned.crt
            SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
            ProxyPass "/wss"  "ws://ec2-13-52-248-221.us-west-1.compute.amazonaws.com:8080" retry=0 keepalive=On

      </VirtualHost>

I am not able to redirect from wss to ws

In Case of Wss I am using below url while sending request :

    wss://ec2-13-52-248-221.us-west-1.compute.amazonaws.com:8080/wss
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

After 24 Hours of efforts Finally I got the solution: This configuration worked for me

First Load following modules by enabling this modules in httpd.conf file in windows

proxy_wstunnel_module modules/mod_proxy_wstunnel.so

In linux you can enable this modules by following commands

sudo a2enmod proxy proxy_balancer proxy_wstunnel proxy_http

Then Just add following lines to apache.conf file or httpd-vhosts.conf file

RewriteEngine on
ProxyRequests Off
ProxyPreserveHost on
ProxyPass /ws ws://192.168.43.31:8080 retry=0 keepalive=On 
ProxyPassReverse /ws  ws://192.168.43.31:8080 retry=0

In Javascript file changes are like this:

if(location.protocol === 'http:'){
  var conn = new WebSocket('ws://192.168.43.31/ws');
 }
else{
  var conn = new WebSocket('wss://192.168.43.31/ws');
}

so from this apache will redirect all request which has ws in back to 8080 port

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!