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

153
Views
How to configure apache to support websockets

I wrote server in python and now I would like to configure apache web server to support websockets. My server returns information when a client sends queries to these addresses:

def make_app():
    return tornado.web.Application([
        (r"/playgame", EmptyGame),
        (r"/playgame/", EmptyGame),
        (r"/playgame/(.*)", PlayerGameWebsocket)
    ])

How to configure the server to support regular user traffic but also to enable websockets when the client establishes such a connection?

I user apache2.4 server.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Ok, it turned out that the solution is trivial. If someone ever looked for an answer, just add a simple redirection to the application in the virtual host configuration which listens on localhost:

ProxyPassMatch "/playgame/(.*)" "ws://127.0.0.1:8888/playgame/$1"
ProxyPassReverse "/playgame/(.*)" "ws://127.0.0.1:8888/playgame/$1"

Thanks to such syntax, we can even pass additional data, e.g. "/playgame/123". We connect from the client without specifying the port:

var adr = "ws://serverip/playgame/" + gameid;
var ws = new WebSocket(adr);
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!