Digitaclocean blockeing

Posted December 25, 2020 1.9k views
ApacheNode.jsUbuntu 16.04

In my localhost working correctly, but in droplet it’s not working because requesting to http from https. How much I understand I can not add ssl certificate for ip address. The solution is instead ip address use domain, but in this case I don’t know how to create open port for domain not for ip address.


const options = {
    cors: {
        origin: "",
        methods: ["GET", "POST"]
    transports: ['websocket', 'polling'],

const http = require('http').Server();
const io = require('')(http, options);

io.on('connection', function (socket) {
    socket.on('message', function (data) {
        io.sockets.emit('add-review', data);

http.listen(6001, '', function(){
    console.log('listening on *:6001');


var socket = io('https://ip-address:6001');

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi @karenshahmuradyan,

You’ll need to use Nginx as a reverse proxy. What it does is, usually HTTP listens on por 80 and HTTPS listens on port 443. With Nginx, you can configure your domain to listen on those ports and internally relay traffic to port 6001 where your is. That’s what a reverse proxy is called.

That way you can install an SSL certificate on the Domain, the connection will be private and secured with going over HTTPS and you’ll be able to use Here is an article on how you can configure Nginx as a reverse proxy:


by Jesin A
In this tutorial you'll configure Nginx as both a web server and as a reverse proxy for Apache to host four domains on a single server.