Deploying Firebase Emulator on EC2 Instance - amazon-ec2

I have a deployed test environment - https://footystats.dev/#/features that I want connecting to the firebase emulator suite for the authentication service.
However when trying to use the UI on port 4000 I am having issues with 3 network requests:
http://172.31.40.139:9099/identitytoolkit.googleapis.com/v1/projects/play-on-dev/accounts:query
http://172.31.40.139:9099/identitytoolkit.googleapis.com/v2/projects/play-on-dev/tenants
http://172.31.40.139:9099/emulator/v1/projects/play-on-dev/config
However this call is working:
http://costagiannakopoulos.com/api/config
Please can anyone advise if I am missing something easy as Iv wasted hours and seem to be going round in circles.
When I run firebase locally so everything is running on localhost it works as expected.
In my attempt to get this working I have set up an EC2 instance with NGINX running as a reverse proxy.
I have created the following domain and subdomain:
http://costagiannakopoulos.com
https://auth.costagiannakopoulos.com
My firebase.json is configured like this:
{
"emulators": {
"auth": {
"host": "172.31.40.139",
"port": 9099
},
"ui": {
"enabled": true,
"host": "172.31.40.139",
"port": 4000
},
"hub": {
"enabled": true,
"host": "172.31.40.139",
"port": 4400
},
"logging": {
"enabled": true,
"host": "172.31.40.139",
"port": 4501
},
"singleProjectMode": true
}
}
The IP host is pointing to the private ip on the EC2 instance.
My NGING config for emulator UI looks like this:
server {
listen 80;
server_name costagiannakopoulos.com;
location / {
proxy_pass http://172.31.40.139:4000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
And the NGINX config for authentication looks like this:
`server {
listen 80;
server_name auth.costagiannakopoulos.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name auth.costagiannakopoulos.com;
ssl_certificate /etc/letsencrypt/live/auth.costagiannakopoulos.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/auth.costagiannakopoulos.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
location / {
proxy_pass http://172.31.40.139:9099;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}`
When hitting this url http://costagiannakopoulos.com/api/config I get this response:
{
"auth": {
"host": "172.31.40.139",
"listen": [
{
"address": "172.31.40.139",
"family": "IPv4",
"port": 9099
}
],
"name": "auth",
"port": 9099
},
"hub": {
"host": "172.31.40.139",
"listen": [
{
"address": "172.31.40.139",
"family": "IPv4",
"port": 4400
}
],
"name": "hub",
"port": 4400
},
"logging": {
"host": "172.31.40.139",
"listen": [
{
"address": "172.31.40.139",
"family": "IPv4",
"port": 4501
}
],
"name": "logging",
"port": 4501
},
"ui": {
"host": "172.31.40.139",
"listen": [
{
"address": "172.31.40.139",
"family": "IPv4",
"port": 4000
}
],
"name": "ui",
"pid": 26141,
"port": 4000
}
}
Thanks
Costa

Related

Laravel-echo-server and socket.io-client does't work on server

I use laravel echo server and socket.io-client and running at localhost is work at port 6001 and I config at server and use port 8443. Events and laravel echo server work but when client side connect, got 200 success and Remote Address: ip:443 instead of ip:8443.
laravel 7.0
laravel-echo-server 1.6.3
socket.io-client 2.3.0
NginxConfig
location /abc/projectpath{
proxy_pass https://blah.com/abc/projectpath:8443;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
root /var/www/html/abc/projectpath/public;
index index.php;
try_files $uri $uri/ /abc/projectpath/server.php$is_args$args;
#limit_conn conn_limit_per_ip 5;
}
Laravel Echo Server
{
"authHost": "https://blah.com/abc/projectpath",
"authEndpoint": "/broadcasting/auth",
"clients": [],
"database": "redis",
"databaseConfig": {
"redis": {},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "8443",
"protocol": "https",
"socketio": {},
"secureOptions": 67108864,
"sslCertPath": "sslpath",
"sslKeyPath": "sslkeypath",
"sslCertChainPath": "",
"sslPassphrase": "",
"subscribers": {
"http": true,
"redis": true
},
"apiOriginAllow": {
"allowCors": false,
"allowOrigin": "",
"allowMethods": "",
"allowHeaders": ""
}
client side
window.io = require('socket.io-client')
window.Echo = new Echo({
broadcaster: 'socket.io',
path: '/abc/projectpath:8443/socket.io',
host: 'https://blah.com'
})

Laravel-echo receives events but doesn't join channel listeners

To start with, I have a real-time chat app (Vue as frontend, Laravel as backend)
On localhost it works perfectly, but not on production.
I've noticed that I do receive events, but I've never been able to join any channel.
Here is all the information, I hope you have any ideas on how to solve it. Thanks!
Main.js (laravel-echo / socket.io connection):
import Echo from "laravel-echo"
window.io = require('socket.io-client')
window.Echo = new Echo({
broadcaster: 'socket.io',
host: 'https://example.com/socket.io',
auth: {
headers: {
'Authorization': `Bearer ${localStorage.getItem('token')}`
}
}
});
Chat component (listener):
window.Echo.private(`chat.${this.user.id}`)
.listen('NewMessage', (e) => {
console.log(e.message);
});
Nginx config:
server {
server_name example.com www.example.com;
root /var/www/html/example/api/public/;
index index.html index.php;
location / {
root /var/www/html/example/web/dist/;
try_files $uri $uri/ /index.html;
}
location /socket.io {
proxy_pass http://localhost:6001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location /api {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.0-fpm.sock;
}
}
Laravel-echo config:
{
"authHost": "https://example.com/api",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "xxx",
"key": "xxxxxxx"
}
],
"database": "redis",
"databaseConfig": {
"redis": {},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "http",
"socketio": {},
"secureOptions": 67108864,
"sslCertPath": "",
"sslKeyPath": "",
"sslCertChainPath": "",
"sslPassphrase": "",
"subscribers": {
"http": true,
"redis": true
},
"apiOriginAllow": {
"allowCors": true,
"allowOrigin": "*",
"allowMethods": "GET, POST",
"allowHeaders": "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id"
}
}
As it's working in local but not in production, you need to check if socket.io path on your domain is proxied to laravel echo server. To check this path run this path in browser and it must return an array. if it's not proxied you will be redirected according to laravel rules.
https://example.com/socket.io must return:
{"code":0,"message":"Transport unknown"}

WebSocket with Laravel-echo-server: 502 Bad gateway

I can't find a solution for more than a week. Everything works fine on the dev server, but not on production. I have no strength, I appeal to you, colleagues :)
I'm using Laravel-echo-server on Socket.io using CloudFlare. When trying to connect, I get an error:
WebSocketError: Unexpected status code received (502 Bad Gateway)
Ubuntu 16.04.7 LTS, Laravel Echo Server: 1.6.1, NodeJs: v12.19.0
laravel-echo-server.json:
{
"authHost": "http://localhost",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "...",
"key": "..."
}
],
"database": "redis",
"databaseConfig": {
"redis": {
"password": "...",
"port": "...",
"db": 0
},
"sqlite": {}
},
"devMode": true,
"host": "",
"port": "6001",
"protocol": "http",
"socketio": {
"transports": ["websocket", "polling"]
},
"secureOptions": 67108864,
"sslCertPath": "",
"sslKeyPath": "",
"sslCertChainPath": "",
"sslPassphrase": "",
"subscribers": {
"http": true,
"redis": true
},
"apiOriginAllow": {
"allowCors": true,
"allowOrigin": "*",
"allowMethods": "GET, POST",
"allowHeaders": "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id"
}
}
Nginx host:
server {
listen 8443 ssl;
server_name domain.tld;
ssl_certificate /etc/nginx/ssl/my.crt;
ssl_certificate_key /etc/nginx/ssl/my.key;
error_log /var/log/nginx/domain.tld/ws.log info;
location /ws {
proxy_pass http://127.0.0.1:6001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
After start EchoServer i see:
L A R A V E L E C H O S E R V E R
version 1.6.1
⚠ Starting server in DEV mode...
✔ Running at localhost on port 6001
✔ Channels are ready.
✔ Listening for http events...
✔ Listening for redis events...
Server ready!
Ok, next:
$ curl 127.0.0.1:6001
> OK
Next:
websocat wss://domain.tld:8443/ws
And I get the error:
websocat: WebSocketError: Received unexpected status code (502 Bad Gateway)
Laravel echo server is running, I can see its events. Tried changing the host in laravel-echo-server.json (127.0.0.1, localhost, null, 0.0.0.0), in nginx proxy to localhost, 127.0.0.1 - nothing helps. I tried to add upstreams in nginx host, it doesn't help.
This information also did not help: https://github.com/tlaverdure/laravel-echo-server/issues/273
Please, help :)
I don't know what the problem is, but I found a solution.
I've updated a lot: updated Nginx to 1.19.1, possibly installed some additional modules. Installed npm not globally, but locally.
And it worked ...
Attention: this only works if you write location /socket.io.
That was not the point for sure: "authHost": "http://localhost"
I assume this is your issue.
{
"authHost": "http://localhost" // This should be your domain name
}

Unable to get socket.io to work in production using Laravel Echo Server and Nginx with HTTPS

I am having trouble getting my Laravel Echo Server to work in a staging/production environment. It works great in my local but not sure why I can't get things going on my Debian 10 VPS. Here is my configuration.
I have no firewall configured yet so there should be no issue with ports being blocked
What I see in the browser console
GET https://dev.domain.com:6001/socket.io/?EIO=3&transport=polling&t=NGLF-O_ net::ERR_CONNECTION_TIMED_OUT
Services are running via Supervisor
root#vultr:/var/www/html/website/storage/logs# supervisorctl status
echo-sever:echo-sever_00 RUNNING pid 28148, uptime 0:22:44
laravel-worker:laravel-worker_00 RUNNING pid 28140, uptime 0:22:44
laravel-worker:laravel-worker_01 RUNNING pid 28141, uptime 0:22:44
laravel-worker:laravel-worker_02 RUNNING pid 28142, uptime 0:22:44
laravel-worker:laravel-worker_03 RUNNING pid 28143, uptime 0:22:44
laravel-worker:laravel-worker_04 RUNNING pid 28144, uptime 0:22:44
laravel-worker:laravel-worker_05 RUNNING pid 28145, uptime 0:22:44
laravel-worker:laravel-worker_06 RUNNING pid 28146, uptime 0:22:44
laravel-worker:laravel-worker_07 RUNNING pid 28147, uptime 0:22:44
peerjs-sever:peerjs-sever_00 RUNNING pid 28149, uptime 0:22:44
Output of Laravel Echo Log
L A R A V E L E C H O S E R V E R
version 1.6.2
⚠ Starting server in DEV mode...
✔ Running at localhost on port 6001
✔ Channels are ready.
✔ Listening for http events...
✔ Listening for redis events...
Server ready!
NGINX CONFIG
server {
#only use default_server if only its the only site running
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html/website/public;
index index.php index.html index.htm index.nginx-debian.html;
server_name dev.domain.com;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
location ~* \.io {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy false;
proxy_pass http://localhost:6001;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location ~ /\.ht {
deny all;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/dev.domain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/dev.domain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
laravel-echo-server.json
{
"authHost": "https://dev.domain.com",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "my-app-id",
"key": "my-app-key"
}
],
"database": "redis",
"databaseConfig": {
"redis": {
"host": "my-redis-ip",
"port": "6379",
"password": "my-redis-pass"
},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "https",
"socketio": {},
"secureOptions": 67108864,
"sslCertPath": "/etc/letsencrypt/live/dev.domain.com/fullchain.pem",
"sslKeyPath": "/etc/letsencrypt/live/dev.domain.com/privkey.pem",
"sslCertChainPath": "",
"sslPassphrase": "",
"subscribers": {
"http": true,
"redis": true
},
"apiOriginAllow": {
"allowCors": true,
"allowOrigin": "https://dev.domain.com",
"allowMethods": "GET, POST",
"allowHeaders": "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id"
}
}
SNIPPET of relevant APP.JS
import Echo from "laravel-echo";
window.io = require("socket.io-client");
window.Echo = new Echo({
broadcaster: "socket.io",
host: "https://dev.domain.com:6001"
});
EDIT:
Forgot to mention, not sure if this is relevant, but I am using Cloudflare with SSL encryption set to FULL and I'm using LetsEncrypt to generate the certificate on the server which can be seen in my Nginx configuration
Not sure what the problem is, but I found a solution.
I've updated a lot: Nginx to 1.19.1, possibly installed additional modules. Installed npm not globally, but locally.
And at some point, it started working as it should. I still don't understand what's the matter)
Note: this only works if you write location /socket.io.
YES !!!!!, i made this working, i am using aws lightsail and in the networking section all you need to do is to allow that port to work,
Here is some of the configuration which I've used to make it work,
resources/js/bootstrap.js
window._ = require('lodash');
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
window.axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
window.axios.defaults.headers.common.crossDomain = true;
window.axios.defaults.baseURL = '/';
let token = document.head.querySelector('meta[name="csrf-token"]');
if (token) {
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
console.error('CSRF token not found: https://adonisjs.com/docs/4.1/csrf');
}
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
import Echo from "laravel-echo";
if (typeof window.io !== "undefined") {
window.Echo = new Echo({
broadcaster: "socket.io",
host: window.location.hostname + ":6001",
auth: {
headers: {
Accept: 'application/json',
Authorization: 'Bearer ' + token
}
},
wsPort: 80,
wssPort: 443,
disableStats: true,
encrypted: true,
forceTLS: true,
transports: ['websocket', 'polling', 'flashsocket'],
enabledTransports: ['ws', 'wss']
});
}
blade file
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.1.2/socket.io.js"></script>
<script src="//{{ Request::getHost() }}:{{env('LARAVEL_ECHO_PORT')}}/socket.io/socket.io.js"></script>
<script src="{{ mix('/js/laravel-echo-setup.js') }}" type="text/javascript"></script>
laravel-echo-server.json
{
"authHost": "http://ip-address-or-domain-name",
"authEndpoint": "/broadcasting/auth",
"clients": [],
"database": "redis",
"databaseConfig": {
"redis": {},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "http",
"socketio": {},
"secureOptions": 67108864,
"sslCertPath": "",
"sslKeyPath": "",
"sslCertChainPath": "",
"sslPassphrase": "",
"subscribers": {
"http": true,
"redis": true
},
"apiOriginAllow": {
"allowCors": true,
"allowOrigin": "http://ip-address-or-domain-name",
"allowMethods": "GET, POST",
"allowHeaders": "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id"
}
}

WebSocket connection to <URL> failed: Error during WebSocket handshake: Unexpected response code: 521

I have a problem with connecting to the socket server.
WebSocket connection to <URL> failed: Error during WebSocket handshake: Unexpected response code: 521
I have two different cloud server (1) for a client project and (2) for a socket server.
(1) Client Project:
var token = "{{ csrf_token() }}";
window.Echo = new Echo({
broadcaster: 'socket.io',
host: "{{env('SOCKET_SERVER_HOST')}}",
origin: '*',
transports: ['websocket', 'polling', 'flashsocket', 'ws', 'wss'],
auth: {
headers: {
'X-CSRF-TOKEN' : token,
}
},
csrfToken:token,
port:"6001",
});
(2) Socket Server
1. nginx
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name mydomain.com;
error_log /var/log/nginx/proxy-error.log error;
ssl on;
ssl_certificate /etc/nginx/certs/mydomain.com.pem;
ssl_certificate_key /etc/nginx/certs/mydomain.com.key;
ssl_session_timeout 3m;
ssl_session_cache shared:SSL:50m;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_ecdh_curve secp384r1;
location /socket.io {
proxy_pass http://mydomaincom:6001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-VerifiedViaNginx yes;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_cache_bypass $http_upgrade;
}
}
laravel-echo-server.json
The below is laravel-echo-server configuration.
{
"authHost": "https://mydomaincom",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "xxxxxxxxxx",
"key": "yyyyyyyyyyyyyyyyyyyyyyyy"
}
],
"database": "redis",
"databaseConfig": {
"redis": {},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "https",
"socketio": {},
"secureOptions": 67108864,
"sslCertPath": "/etc/nginx/certs/mydomain.com.pem",
"sslKeyPath": "/etc/nginx/certs/mydomain.com.key",
"sslCertChainPath": "",
"sslPassphrase": "",
"subscribers": {
"http": true,
"redis": true
},
"apiOriginAllow": {
"allowCors": true,
"allowOrigin": "*",
"allowMethods": "GET, POST",
"allowHeaders": "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id"
}
}
Supervisor
Here is the supervisor configuration.
[program:echo-worker]
directory=/home/user/apps/epanel
process_name=%(program_name)s_%(process_num)02d
command=laravel-echo-server start --config="ehealth-echo-server.json"
autostart=true
autorestart=true
user=user
numprocs=1
redirect_stderr=true
stdout_logfile=/home/user/apps/epanel/echo.log
2. Laravel Echo Server
Note: I use redis and laravel-echo-server and it's work very fine.
Does anyone have a solution?
This document is for those who use laravel echo server & nginx & socket.io & redis-server with separated server between client project and redis-server.
1) Edit /etc/redis/redis.conf
bind 127.0.0.1
supervised no
To
bind 0.0.0.0
supervised systemd
2) Update /etc/systemd/system/redis.service under [Service]
Type=notify
ExecStart=/usr/bin/redis-server /etc/redis/redis.conf --supervised systemd
3) Nginx /etc/nginx/sites-enabled/reverse-proxy.conf
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name mysitecom;
error_log /var/log/nginx/proxy-error.log error;
# Start the SSL configurations
ssl on;
ssl_certificate /etc/nginx/certs/mysitecom.pem;
ssl_certificate_key /etc/nginx/certs/mysitecom.key;
ssl_session_timeout 3m;
ssl_session_cache shared:SSL:50m;
ssl_protocols TLSv1.1 TLSv1.2;
# Diffie-Hellman performance improvements
ssl_ecdh_curve secp384r1;
location /socket.io {
proxy_pass http://mysitecom:2096;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_buffers 16 4k;
proxy_buffer_size 2k;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-VerifiedViaNginx yes;
proxy_read_timeout 2h;
proxy_connect_timeout 2h;
proxy_redirect off;
}
}
4) laravel-echo-server.json
{
"authHost": "https://mysitecom",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "e45c056ec8ca8bd7",
"key": "88d316b5cccafbc5e905aa9ee13e63f7"
}
],
"database": "redis",
"databaseConfig": {
"redis": {
"host": "0.0.0.0",
"port": "6379"
},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": null,
"port": "2096",
"protocol": "https",
"socketio": {},
"secureOptions": 67108864,
"sslCertPath": "/etc/nginx/certs/mysitecom.pem",
"sslKeyPath": "/etc/nginx/certs/mysitecom.key",
"sslCertChainPath": "",
"sslPassphrase": "",
"subscribers": {
"http": true,
"redis": true
},
"apiOriginAllow": {
"allowCors": true,
"allowOrigin": "*",
"allowMethods": "GET, POST",
"allowHeaders": "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id"
}
}
Note: for someone who connects DNS with cloudflare please change default socket.io port 6001 to the following here.

Resources