Can't connect to websocket using ssl and apacheSetting up a websocket on Apache?Socket.io client can't connect after first attemptNode js ECONNRESETWhich WebSocket library to use in Android app?socket.io transport is 'polling' instead of 'websocket' on azuresocket.io socket.on('connect'… not allowing same page to get multiple socketsSocket.io client with non-socket.io serverComfiguring Apache for socket.io and SSL / WSSConnection to websocket server : OK from javascript, not OK from phpReact WebSocket integration sockjs react-websocket socketio-clientHow to run socket.io on port 443 where apache is running?

A nasty indefinite integral

How can I reduce the size of matrix?

What is the winged creature on the back of the Mordenkainen's Tome of Foes book?

What is the required burn to keep a satellite at a Lagrangian point?

Is there an idiom that means that you are in a very strong negotiation position in a negotiation?

Three knights or knaves, three different hair colors

Is a world with one country feeding everyone possible?

Ribbon Cable Cross Talk - Is there a fix after the fact?

Can a bard grant bardic inspiration to an unconscious creature?

What to call a small, open stone or cement reservoir that supplies fresh water from a spring or other natural source?

Nunc est bibendum: gerund or gerundive?

Must every right-inverse of a linear transformation be a linear transformation?

Is it safe to redirect stdout and stderr to the same file without file descriptor copies?

Existence of a model of ZFC in which the natural numbers are really the natural numbers

Why is 'additive' EQ more difficult to use than 'subtractive'?

Does ls -R make any sense with -d?

Were there any developed countries that became "undeveloped" for reasons other than war?

Caught with my phone during an exam

Is there a linguistic basses for how to translate John 8:43, or are translations basing their translation on context alone?

Real Analysis: Proof of the equivalent definitions of the derivative.

What does it mean for something to be strictly less than epsilon for an arbitrary epsilon?

Can diplomats be allowed on the flight deck of a commercial European airline?

How to become an Editorial board member?

Why is this integration method not valid?



Can't connect to websocket using ssl and apache


Setting up a websocket on Apache?Socket.io client can't connect after first attemptNode js ECONNRESETWhich WebSocket library to use in Android app?socket.io transport is 'polling' instead of 'websocket' on azuresocket.io socket.on('connect'… not allowing same page to get multiple socketsSocket.io client with non-socket.io serverComfiguring Apache for socket.io and SSL / WSSConnection to websocket server : OK from javascript, not OK from phpReact WebSocket integration sockjs react-websocket socketio-clientHow to run socket.io on port 443 where apache is running?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








4















I am tying to connect my client to the server socket using socket.io. When I am using http all works fine but when I try to use https the client can't connect.



I try to create the server using http require('https') and using certificates but didn't work.



For now after a few code changes and tests this is how my code is:



Server, index.js



var https = require('https');
var app = express();
var options =
key: fs.readFileSync('./server-key.pem'),
cert: fs.readFileSync('./server-crt.pem'),
ca: fs.readFileSync('./ca-crt.pem'),
requestCert: false,
rejectUnauthorized: false
;


var server = https.createServer(options, app);¡
var io = require('socket.io')(server);

server.listen(3003, function()
console.log('server up and running at %s port', 3003);
);


io.on('connection', function(client)
console.log("NUEVO CLIENTE");
client.on('event', function(data));
client.on('disconnect', function());
client.on('setRoom', function(room)
client.room = room;
client.join(room);
);
client.on('leaveRroom', function(room)
client.leave(room);
);

);



The server connection always success using port 3003.



Client



$scope.socket = io.connect('https://socket.softgym.com/', transports: ['websocket'],rejectUnauthorized: false);
$scope.socket.on('connect_error', function (data)
console.log(data);
);

$scope.socket.on('message', function(message)
$scope.getAttendance();
$scope.clientDetails(message.user[0]);
)



Browser logs:



socket.io-client:manager opening https://socket.softgym.com/ +0ms
VM74:6 engine.io-client:socket creating transport "websocket" +5s
VM74:6 engine.io-client:socket setting transport websocket +1ms
VM74:6 socket.io-client:manager connect attempt will timeout after 20000 +4ms
VM74:7 WebSocket connection to 'wss://socket.softgym.com/socket.io/?EIO=3&transport=websocket' failed: Error during WebSocket handshake: Unexpected response code: 500
r.doOpen @ VM74:7
r.open @ VM74:7
r.open @ VM74:6
r @ VM74:6
r @ VM74:6
r.open.r.connect @ VM74:6
(anonymous) @ VM74:6
VM74:6 engine.io-client:socket socket error "type":"TransportError","description":"isTrusted":true +502ms
VM74:6 socket.io-client:manager connect_error +501ms
VM74:6 socket.io-client:manager cleanup +0ms
access.js:51 Error: websocket error
at r.onError (eval at <anonymous> (jquery.min.js:2), <anonymous>:7:8015)
at WebSocket.ws.onerror (eval at <anonymous> (jquery.min.js:2), <anonymous>:7:23668)
VM74:6 socket.io-client:manager reconnect attempt error +1ms
VM74:6 socket.io-client:manager will wait 5000ms before reconnect attempt +1ms
VM74:6 engine.io-client:socket socket close with reason: "transport error" +4ms
VM74:6 socket.io-client:manager attempting reconnect +5s
VM74:6 socket.io-client:manager readyState closed +1ms


For the ssl I am using load balancer for AWS.
enter image description here



This is my apache site:



<VirtualHost *:80>
ServerName socket.softgym.com
ServerAlias www.socket.softgym.com
ServerAdmin webmaster@localhost
RewriteEngine On
RewriteCond %REQUEST_URI ^/socket.io [NC]
RewriteCond %QUERY_STRING transport=websocket [NC]
RewriteRule /(.*) wss://localhost:3003/%1 [P,L]

ProxyPass /socket.io https://localhost:3003/socket.io
ProxyPassReverse /socket.io https://localhost:3003/socket.io

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


I expect the client connect successfully with the server over https.










share|improve this question
























  • How are you using apache?. The AWS Load balancer is forwarding the request directly to the PORT 3003 of the Node.js APP, or not?

    – Marcos Casagrande
    Mar 29 at 22:56











  • @MarcosCasagrande yes I am using apache. The AWS Load balancer is only listening to protocol http and https not requesting directly to PORT 3003 (Edit Post).

    – D.Pacheco
    Mar 29 at 23:15











  • So apache is listening on port 80, and then you do proxy pass to your Node.js server?, if so show your apache2 settings.

    – Marcos Casagrande
    Mar 29 at 23:16











  • What's the %1 supposed to be a backreference to? There's no capture in the conditions. What does the Apache error log say?

    – covener
    Mar 30 at 23:58

















4















I am tying to connect my client to the server socket using socket.io. When I am using http all works fine but when I try to use https the client can't connect.



I try to create the server using http require('https') and using certificates but didn't work.



For now after a few code changes and tests this is how my code is:



Server, index.js



var https = require('https');
var app = express();
var options =
key: fs.readFileSync('./server-key.pem'),
cert: fs.readFileSync('./server-crt.pem'),
ca: fs.readFileSync('./ca-crt.pem'),
requestCert: false,
rejectUnauthorized: false
;


var server = https.createServer(options, app);¡
var io = require('socket.io')(server);

server.listen(3003, function()
console.log('server up and running at %s port', 3003);
);


io.on('connection', function(client)
console.log("NUEVO CLIENTE");
client.on('event', function(data));
client.on('disconnect', function());
client.on('setRoom', function(room)
client.room = room;
client.join(room);
);
client.on('leaveRroom', function(room)
client.leave(room);
);

);



The server connection always success using port 3003.



Client



$scope.socket = io.connect('https://socket.softgym.com/', transports: ['websocket'],rejectUnauthorized: false);
$scope.socket.on('connect_error', function (data)
console.log(data);
);

$scope.socket.on('message', function(message)
$scope.getAttendance();
$scope.clientDetails(message.user[0]);
)



Browser logs:



socket.io-client:manager opening https://socket.softgym.com/ +0ms
VM74:6 engine.io-client:socket creating transport "websocket" +5s
VM74:6 engine.io-client:socket setting transport websocket +1ms
VM74:6 socket.io-client:manager connect attempt will timeout after 20000 +4ms
VM74:7 WebSocket connection to 'wss://socket.softgym.com/socket.io/?EIO=3&transport=websocket' failed: Error during WebSocket handshake: Unexpected response code: 500
r.doOpen @ VM74:7
r.open @ VM74:7
r.open @ VM74:6
r @ VM74:6
r @ VM74:6
r.open.r.connect @ VM74:6
(anonymous) @ VM74:6
VM74:6 engine.io-client:socket socket error "type":"TransportError","description":"isTrusted":true +502ms
VM74:6 socket.io-client:manager connect_error +501ms
VM74:6 socket.io-client:manager cleanup +0ms
access.js:51 Error: websocket error
at r.onError (eval at <anonymous> (jquery.min.js:2), <anonymous>:7:8015)
at WebSocket.ws.onerror (eval at <anonymous> (jquery.min.js:2), <anonymous>:7:23668)
VM74:6 socket.io-client:manager reconnect attempt error +1ms
VM74:6 socket.io-client:manager will wait 5000ms before reconnect attempt +1ms
VM74:6 engine.io-client:socket socket close with reason: "transport error" +4ms
VM74:6 socket.io-client:manager attempting reconnect +5s
VM74:6 socket.io-client:manager readyState closed +1ms


For the ssl I am using load balancer for AWS.
enter image description here



This is my apache site:



<VirtualHost *:80>
ServerName socket.softgym.com
ServerAlias www.socket.softgym.com
ServerAdmin webmaster@localhost
RewriteEngine On
RewriteCond %REQUEST_URI ^/socket.io [NC]
RewriteCond %QUERY_STRING transport=websocket [NC]
RewriteRule /(.*) wss://localhost:3003/%1 [P,L]

ProxyPass /socket.io https://localhost:3003/socket.io
ProxyPassReverse /socket.io https://localhost:3003/socket.io

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


I expect the client connect successfully with the server over https.










share|improve this question
























  • How are you using apache?. The AWS Load balancer is forwarding the request directly to the PORT 3003 of the Node.js APP, or not?

    – Marcos Casagrande
    Mar 29 at 22:56











  • @MarcosCasagrande yes I am using apache. The AWS Load balancer is only listening to protocol http and https not requesting directly to PORT 3003 (Edit Post).

    – D.Pacheco
    Mar 29 at 23:15











  • So apache is listening on port 80, and then you do proxy pass to your Node.js server?, if so show your apache2 settings.

    – Marcos Casagrande
    Mar 29 at 23:16











  • What's the %1 supposed to be a backreference to? There's no capture in the conditions. What does the Apache error log say?

    – covener
    Mar 30 at 23:58













4












4








4


1






I am tying to connect my client to the server socket using socket.io. When I am using http all works fine but when I try to use https the client can't connect.



I try to create the server using http require('https') and using certificates but didn't work.



For now after a few code changes and tests this is how my code is:



Server, index.js



var https = require('https');
var app = express();
var options =
key: fs.readFileSync('./server-key.pem'),
cert: fs.readFileSync('./server-crt.pem'),
ca: fs.readFileSync('./ca-crt.pem'),
requestCert: false,
rejectUnauthorized: false
;


var server = https.createServer(options, app);¡
var io = require('socket.io')(server);

server.listen(3003, function()
console.log('server up and running at %s port', 3003);
);


io.on('connection', function(client)
console.log("NUEVO CLIENTE");
client.on('event', function(data));
client.on('disconnect', function());
client.on('setRoom', function(room)
client.room = room;
client.join(room);
);
client.on('leaveRroom', function(room)
client.leave(room);
);

);



The server connection always success using port 3003.



Client



$scope.socket = io.connect('https://socket.softgym.com/', transports: ['websocket'],rejectUnauthorized: false);
$scope.socket.on('connect_error', function (data)
console.log(data);
);

$scope.socket.on('message', function(message)
$scope.getAttendance();
$scope.clientDetails(message.user[0]);
)



Browser logs:



socket.io-client:manager opening https://socket.softgym.com/ +0ms
VM74:6 engine.io-client:socket creating transport "websocket" +5s
VM74:6 engine.io-client:socket setting transport websocket +1ms
VM74:6 socket.io-client:manager connect attempt will timeout after 20000 +4ms
VM74:7 WebSocket connection to 'wss://socket.softgym.com/socket.io/?EIO=3&transport=websocket' failed: Error during WebSocket handshake: Unexpected response code: 500
r.doOpen @ VM74:7
r.open @ VM74:7
r.open @ VM74:6
r @ VM74:6
r @ VM74:6
r.open.r.connect @ VM74:6
(anonymous) @ VM74:6
VM74:6 engine.io-client:socket socket error "type":"TransportError","description":"isTrusted":true +502ms
VM74:6 socket.io-client:manager connect_error +501ms
VM74:6 socket.io-client:manager cleanup +0ms
access.js:51 Error: websocket error
at r.onError (eval at <anonymous> (jquery.min.js:2), <anonymous>:7:8015)
at WebSocket.ws.onerror (eval at <anonymous> (jquery.min.js:2), <anonymous>:7:23668)
VM74:6 socket.io-client:manager reconnect attempt error +1ms
VM74:6 socket.io-client:manager will wait 5000ms before reconnect attempt +1ms
VM74:6 engine.io-client:socket socket close with reason: "transport error" +4ms
VM74:6 socket.io-client:manager attempting reconnect +5s
VM74:6 socket.io-client:manager readyState closed +1ms


For the ssl I am using load balancer for AWS.
enter image description here



This is my apache site:



<VirtualHost *:80>
ServerName socket.softgym.com
ServerAlias www.socket.softgym.com
ServerAdmin webmaster@localhost
RewriteEngine On
RewriteCond %REQUEST_URI ^/socket.io [NC]
RewriteCond %QUERY_STRING transport=websocket [NC]
RewriteRule /(.*) wss://localhost:3003/%1 [P,L]

ProxyPass /socket.io https://localhost:3003/socket.io
ProxyPassReverse /socket.io https://localhost:3003/socket.io

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


I expect the client connect successfully with the server over https.










share|improve this question
















I am tying to connect my client to the server socket using socket.io. When I am using http all works fine but when I try to use https the client can't connect.



I try to create the server using http require('https') and using certificates but didn't work.



For now after a few code changes and tests this is how my code is:



Server, index.js



var https = require('https');
var app = express();
var options =
key: fs.readFileSync('./server-key.pem'),
cert: fs.readFileSync('./server-crt.pem'),
ca: fs.readFileSync('./ca-crt.pem'),
requestCert: false,
rejectUnauthorized: false
;


var server = https.createServer(options, app);¡
var io = require('socket.io')(server);

server.listen(3003, function()
console.log('server up and running at %s port', 3003);
);


io.on('connection', function(client)
console.log("NUEVO CLIENTE");
client.on('event', function(data));
client.on('disconnect', function());
client.on('setRoom', function(room)
client.room = room;
client.join(room);
);
client.on('leaveRroom', function(room)
client.leave(room);
);

);



The server connection always success using port 3003.



Client



$scope.socket = io.connect('https://socket.softgym.com/', transports: ['websocket'],rejectUnauthorized: false);
$scope.socket.on('connect_error', function (data)
console.log(data);
);

$scope.socket.on('message', function(message)
$scope.getAttendance();
$scope.clientDetails(message.user[0]);
)



Browser logs:



socket.io-client:manager opening https://socket.softgym.com/ +0ms
VM74:6 engine.io-client:socket creating transport "websocket" +5s
VM74:6 engine.io-client:socket setting transport websocket +1ms
VM74:6 socket.io-client:manager connect attempt will timeout after 20000 +4ms
VM74:7 WebSocket connection to 'wss://socket.softgym.com/socket.io/?EIO=3&transport=websocket' failed: Error during WebSocket handshake: Unexpected response code: 500
r.doOpen @ VM74:7
r.open @ VM74:7
r.open @ VM74:6
r @ VM74:6
r @ VM74:6
r.open.r.connect @ VM74:6
(anonymous) @ VM74:6
VM74:6 engine.io-client:socket socket error "type":"TransportError","description":"isTrusted":true +502ms
VM74:6 socket.io-client:manager connect_error +501ms
VM74:6 socket.io-client:manager cleanup +0ms
access.js:51 Error: websocket error
at r.onError (eval at <anonymous> (jquery.min.js:2), <anonymous>:7:8015)
at WebSocket.ws.onerror (eval at <anonymous> (jquery.min.js:2), <anonymous>:7:23668)
VM74:6 socket.io-client:manager reconnect attempt error +1ms
VM74:6 socket.io-client:manager will wait 5000ms before reconnect attempt +1ms
VM74:6 engine.io-client:socket socket close with reason: "transport error" +4ms
VM74:6 socket.io-client:manager attempting reconnect +5s
VM74:6 socket.io-client:manager readyState closed +1ms


For the ssl I am using load balancer for AWS.
enter image description here



This is my apache site:



<VirtualHost *:80>
ServerName socket.softgym.com
ServerAlias www.socket.softgym.com
ServerAdmin webmaster@localhost
RewriteEngine On
RewriteCond %REQUEST_URI ^/socket.io [NC]
RewriteCond %QUERY_STRING transport=websocket [NC]
RewriteRule /(.*) wss://localhost:3003/%1 [P,L]

ProxyPass /socket.io https://localhost:3003/socket.io
ProxyPassReverse /socket.io https://localhost:3003/socket.io

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


I expect the client connect successfully with the server over https.







node.js angular apache amazon-web-services socket.io






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 29 at 23:25







D.Pacheco

















asked Mar 23 at 20:14









D.PachecoD.Pacheco

11911




11911












  • How are you using apache?. The AWS Load balancer is forwarding the request directly to the PORT 3003 of the Node.js APP, or not?

    – Marcos Casagrande
    Mar 29 at 22:56











  • @MarcosCasagrande yes I am using apache. The AWS Load balancer is only listening to protocol http and https not requesting directly to PORT 3003 (Edit Post).

    – D.Pacheco
    Mar 29 at 23:15











  • So apache is listening on port 80, and then you do proxy pass to your Node.js server?, if so show your apache2 settings.

    – Marcos Casagrande
    Mar 29 at 23:16











  • What's the %1 supposed to be a backreference to? There's no capture in the conditions. What does the Apache error log say?

    – covener
    Mar 30 at 23:58

















  • How are you using apache?. The AWS Load balancer is forwarding the request directly to the PORT 3003 of the Node.js APP, or not?

    – Marcos Casagrande
    Mar 29 at 22:56











  • @MarcosCasagrande yes I am using apache. The AWS Load balancer is only listening to protocol http and https not requesting directly to PORT 3003 (Edit Post).

    – D.Pacheco
    Mar 29 at 23:15











  • So apache is listening on port 80, and then you do proxy pass to your Node.js server?, if so show your apache2 settings.

    – Marcos Casagrande
    Mar 29 at 23:16











  • What's the %1 supposed to be a backreference to? There's no capture in the conditions. What does the Apache error log say?

    – covener
    Mar 30 at 23:58
















How are you using apache?. The AWS Load balancer is forwarding the request directly to the PORT 3003 of the Node.js APP, or not?

– Marcos Casagrande
Mar 29 at 22:56





How are you using apache?. The AWS Load balancer is forwarding the request directly to the PORT 3003 of the Node.js APP, or not?

– Marcos Casagrande
Mar 29 at 22:56













@MarcosCasagrande yes I am using apache. The AWS Load balancer is only listening to protocol http and https not requesting directly to PORT 3003 (Edit Post).

– D.Pacheco
Mar 29 at 23:15





@MarcosCasagrande yes I am using apache. The AWS Load balancer is only listening to protocol http and https not requesting directly to PORT 3003 (Edit Post).

– D.Pacheco
Mar 29 at 23:15













So apache is listening on port 80, and then you do proxy pass to your Node.js server?, if so show your apache2 settings.

– Marcos Casagrande
Mar 29 at 23:16





So apache is listening on port 80, and then you do proxy pass to your Node.js server?, if so show your apache2 settings.

– Marcos Casagrande
Mar 29 at 23:16













What's the %1 supposed to be a backreference to? There's no capture in the conditions. What does the Apache error log say?

– covener
Mar 30 at 23:58





What's the %1 supposed to be a backreference to? There's no capture in the conditions. What does the Apache error log say?

– covener
Mar 30 at 23:58












1 Answer
1






active

oldest

votes


















3





+25









Seems like your proxy server does not supports WebScokets upgrade. If you are using apache the configuration is not simple. You will have to install mod_proxy_ws_tunnel module to do this.



Follow this link




Web sockets upgrade is a process that user upgrade from HTTP protocol to WebSckets protocol by sending a upgrade header followed by a three way hand shake. You may find some resources about configuring apache with websocket here




Also if apache server is not required, and you can use another proxy serve. Install nginx and your life will get easier. Then simply add this configuration to your nginx configuration.



location ~* .io 
.. your configuration

proxy_pass http://localhost:3000;
proxy_redirect off;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";



Hope that helps.






share|improve this answer























  • It's works but having apache2 and nginx installed on the same server makes trouble, I uninstalled apache2 and it works correctly.

    – D.Pacheco
    Apr 8 at 13:09











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55317965%2fcant-connect-to-websocket-using-ssl-and-apache%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3





+25









Seems like your proxy server does not supports WebScokets upgrade. If you are using apache the configuration is not simple. You will have to install mod_proxy_ws_tunnel module to do this.



Follow this link




Web sockets upgrade is a process that user upgrade from HTTP protocol to WebSckets protocol by sending a upgrade header followed by a three way hand shake. You may find some resources about configuring apache with websocket here




Also if apache server is not required, and you can use another proxy serve. Install nginx and your life will get easier. Then simply add this configuration to your nginx configuration.



location ~* .io 
.. your configuration

proxy_pass http://localhost:3000;
proxy_redirect off;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";



Hope that helps.






share|improve this answer























  • It's works but having apache2 and nginx installed on the same server makes trouble, I uninstalled apache2 and it works correctly.

    – D.Pacheco
    Apr 8 at 13:09















3





+25









Seems like your proxy server does not supports WebScokets upgrade. If you are using apache the configuration is not simple. You will have to install mod_proxy_ws_tunnel module to do this.



Follow this link




Web sockets upgrade is a process that user upgrade from HTTP protocol to WebSckets protocol by sending a upgrade header followed by a three way hand shake. You may find some resources about configuring apache with websocket here




Also if apache server is not required, and you can use another proxy serve. Install nginx and your life will get easier. Then simply add this configuration to your nginx configuration.



location ~* .io 
.. your configuration

proxy_pass http://localhost:3000;
proxy_redirect off;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";



Hope that helps.






share|improve this answer























  • It's works but having apache2 and nginx installed on the same server makes trouble, I uninstalled apache2 and it works correctly.

    – D.Pacheco
    Apr 8 at 13:09













3





+25







3





+25



3




+25





Seems like your proxy server does not supports WebScokets upgrade. If you are using apache the configuration is not simple. You will have to install mod_proxy_ws_tunnel module to do this.



Follow this link




Web sockets upgrade is a process that user upgrade from HTTP protocol to WebSckets protocol by sending a upgrade header followed by a three way hand shake. You may find some resources about configuring apache with websocket here




Also if apache server is not required, and you can use another proxy serve. Install nginx and your life will get easier. Then simply add this configuration to your nginx configuration.



location ~* .io 
.. your configuration

proxy_pass http://localhost:3000;
proxy_redirect off;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";



Hope that helps.






share|improve this answer













Seems like your proxy server does not supports WebScokets upgrade. If you are using apache the configuration is not simple. You will have to install mod_proxy_ws_tunnel module to do this.



Follow this link




Web sockets upgrade is a process that user upgrade from HTTP protocol to WebSckets protocol by sending a upgrade header followed by a three way hand shake. You may find some resources about configuring apache with websocket here




Also if apache server is not required, and you can use another proxy serve. Install nginx and your life will get easier. Then simply add this configuration to your nginx configuration.



location ~* .io 
.. your configuration

proxy_pass http://localhost:3000;
proxy_redirect off;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";



Hope that helps.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 31 at 4:09









JKKJKK

1,726716




1,726716












  • It's works but having apache2 and nginx installed on the same server makes trouble, I uninstalled apache2 and it works correctly.

    – D.Pacheco
    Apr 8 at 13:09

















  • It's works but having apache2 and nginx installed on the same server makes trouble, I uninstalled apache2 and it works correctly.

    – D.Pacheco
    Apr 8 at 13:09
















It's works but having apache2 and nginx installed on the same server makes trouble, I uninstalled apache2 and it works correctly.

– D.Pacheco
Apr 8 at 13:09





It's works but having apache2 and nginx installed on the same server makes trouble, I uninstalled apache2 and it works correctly.

– D.Pacheco
Apr 8 at 13:09



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55317965%2fcant-connect-to-websocket-using-ssl-and-apache%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript