LoginSignup
5
4

More than 5 years have passed since last update.

[WebSocket] Apache24とsocket.ioのリバースプロキシについて

Posted at

延々調べたあげく、ぜんぜんうまく行かず、、試行錯誤の結果、下記に落ち着いた。

httpd.conf
Listen 80
<Location /ws>
    ProxyPass http://localhost:8080/socket.io/
    ProxyPassReverse http://localhost:8080/socket.io/
</Location>
server.js
var PORT, app, http, io;
PORT = 8080;
app = require("express")();
http = require("http").Server(app);
io = require("socket.io")(http);
io.set("origins", "*:*");
client.js
var socket;
socket = io.connect(location.protocol + "//" + location.hostname + ":" + location.port, {
  path: "/ws/socket.io"
});
5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4