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

266
Views
Apache2 + Socket.io reverse proxy : the right way to proceed

this is not a question but a great help difficult to find on the internet,

to correctly configure socket.io with apache2 through websocket requests and not polling requests, here is how to proceed:

First : create your socket.io server like const io = require('socket.io')(yourPort)

Second : add in your favorite vHost these parameters

RewriteEngine On
RewriteCond %{REQUEST_URI}  ^/socket.io            [NC]
RewriteCond %{QUERY_STRING} transport=websocket    [NC]
RewriteRule /(.*)           ws://localhost:yourPort/$1 [P,L]

ProxyPass        /socket.io http://localhost:yourPort/socket.io
ProxyPassReverse /socket.io http://localhost:yourPort/socket.io

(modify yourPort by the correct port where your server listen)

Third : Create your HTML page with

let socket = io.connect('yourWebsite', { transports: ['websocket'] });

Now if you want you can add this in your server for check if it's work

io.on("connection", socket => {
  console.log("it's work !")
})

100% working do not thank me :) Have a nice day.

about 4 years ago · Juan Pablo Isaza
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!