Node Js will not connect via http, but will exceed https?

I have a site that uses node js to do a couple of things, but I need it to connect via http, not https.

It works;

var socket = io.connect("https://secure.tp.uk.com:3000");

But this is not so:

var socket = io.connect("http://secure.tp.uk.com:3000");

I get an error

Net :: ERR_EMPTY_RESPONSE

Here is my node server script;

var http = require('http');
var fs = require('fs');
var express = require('express'),
app = module.exports.app = express();


var server = http.createServer(app);
var io = require('socket.io').listen(server);

server.listen(3000);

var demoUsers = [];
var tpUsers = [];
var activeGls = [];

io.sockets.on('connection', function (socket) {
   // here are all my functions which i know work because it works fine over https!!
});

This original one worked on http, but I tested a few things with https, but I had problems with https on ios devices, so now I need to get it working with http!

Here is my configuration file for the site. / Etc. / apache2 / sites-accessible /

<VirtualHost *:80>
    ServerName secure.tp.uk.com
    ServerAlias secure.tp.uk.com
    DocumentRoot /var/www/laravel/public

    <Directory /var/www/laravel/public>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>
+4
source share
1 answer

URL- , , "" URL-, , , URL- http? , , URL- http , , , EMPTY_RESPONSE.

0

Source: https://habr.com/ru/post/1622729/


All Articles