Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7847081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:47:00+00:00 2026-06-02T17:47:00+00:00

My socket.io chat is accessible through the URL http://example.com:8080/ . Dreamhost does not allow

  • 0

My socket.io chat is accessible through the URL http://example.com:8080/. Dreamhost does not allow us to bind 80, so I am binding it on 8080.

I wanted to get rid of the port number in the URL. So, I used Dreamhost’s Proxy Server feature (http://wiki.dreamhost.com/Proxy_Server), which is Apache’s mod_proxy.

I proxied the port number 8080 to the URL http://example.com/socketchat. When I go to that URL, the chat does not work. I get this error:

“Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /socket/.
Reason: Error reading from remote server”

Is there a way to get rid of the port number in the URL that works with socket.io? If nothing works, would it be a security risk if I leave the port number in the URL when I launch my website to the public? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T17:47:01+00:00Added an answer on June 2, 2026 at 5:47 pm

    Whether Apache quickly becomes a bottleneck or not depends on how you’re using it exactly. It’s a very mature web server and is hosting massive websites around the world just fine. Regardless, your socket.io application doesn’t necessarily have to share the same port as your web application. You could have socket.io listen on port 8081, and have your normal http requests on port 8080. Then you would setup your proxy to point to 8080 as you have it now, and just have your socket.io connection go to 8081.

    The port in this case shouldn’t be a problem as it’s not something a user would see in their URL, and the socket.io communication wouldn’t have to go through the proxy. If you’re serving enough requests for Apache to legitimately be a bottleneck, you should be able to spring for a better hosting environment anyway!

    Example

    Server

    var app = require('http').createServer(handler)
      , io = require('socket.io').listen(8081)
      , fs = require('fs')
    
    app.listen(8080);
    
    function handler (req, res) {
      fs.readFile(__dirname + '/index.html',
      function (err, data) {
        if (err) {
          res.writeHead(500);
          return res.end('Error loading index.html');
        }
    
        res.writeHead(200);
        res.end(data);
      });
    }
    
    io.sockets.on('connection', function (socket) {
      socket.emit('news', { hello: 'world' });
      socket.on('my other event', function (data) {
        console.log(data);
      });
    });
    

    Notice that the webserver is listening on a separate port than the socket.io connection. This means you can safely proxy the normal http requests from 80 to 8080 using mod_proxy, and socket.io can communicate quite happily on port 8081 directly, bypassing the proxy. Your users will not have to type in a port in order to get to the site.

    Client

    <script src="http://domain.com:8081/socket.io/socket.io.js"></script>
    <script>
      var socket = io.connect('http://domain.com:8081');
      socket.on('news', function (data) {
        console.log(data);
        socket.emit('my other event', { my: 'data' });
      });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I basically try to reproduce the Socket example from here: http://www.silverlightshow.net/items/Sockets-and-their-implementation-in-SL2-Beta-1-including-a-chat-like-example.aspx I only made
The socket server listed in step 3 from http://pirate.shu.edu/~wachsmut/Teaching/CSAS2214/Virtual/Lectures/chat-client-server.html builds cleanly (java version 1.7.0_02)
Does anybody know how to make socket chat in C++ using something like sockets
import socket irc = 'irc.hack3r.com' port = 6667 channel = '#chat' sck = socket.socket(socket.AF_INET,
I am trying to understand a code from socket.io/examples/chat/app.js . I am not able
I want to create SOCKET chat(server + clients) with private messaging. When client write
I'd like to write a basic socket chat app, except encrypted. Y'know all those
I have a chat application(Socket Programming) , for that consider I have 2 separate
I'm working on a chat application with Node.js and Socket.io, and on disconnect, the
I've got a socket server running (it's something that's basically like a chat server).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.