Socketio can't connect through https
up vote
0
down vote
favorite
I'm on the final stage with my node/feathers app. While I pushed an app at the server on which as deamon http is running nginx all is work great. When I used certbot for centos7 / nginx in order to SSL after reload page my socket.io can not load - error: secure error. I use public domain and for this domain created a cert.
I use below config on client side:
var socket = io({transports: ['websocket']});
var app = feathers()
.configure(feathers.hooks())
.configure(feathers.socketio(socket))
.configure(feathers.authentication({ storage: window.localStorage }))
app.js
// I added below code to end line of app.js file
const opts = {
key: fs.readFileSync('./privkey.pem'),
cert: fs.readFileSync('./cert.pem')
};
const server = https.createServer(opts, app);
app.setup(server);
module.exports = app;
Nginx:
server {
server_name subdomain www.subdomain;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:3030;
proxy_redirect off;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/subdomain/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/subdomain/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
}
server {
if ($host = subdomain) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name subdomain;
return 404; # managed by Certbot
}
where is the problem?
node.js ssl nginx socket.io feathersjs
add a comment |
up vote
0
down vote
favorite
I'm on the final stage with my node/feathers app. While I pushed an app at the server on which as deamon http is running nginx all is work great. When I used certbot for centos7 / nginx in order to SSL after reload page my socket.io can not load - error: secure error. I use public domain and for this domain created a cert.
I use below config on client side:
var socket = io({transports: ['websocket']});
var app = feathers()
.configure(feathers.hooks())
.configure(feathers.socketio(socket))
.configure(feathers.authentication({ storage: window.localStorage }))
app.js
// I added below code to end line of app.js file
const opts = {
key: fs.readFileSync('./privkey.pem'),
cert: fs.readFileSync('./cert.pem')
};
const server = https.createServer(opts, app);
app.setup(server);
module.exports = app;
Nginx:
server {
server_name subdomain www.subdomain;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:3030;
proxy_redirect off;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/subdomain/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/subdomain/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
}
server {
if ($host = subdomain) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name subdomain;
return 404; # managed by Certbot
}
where is the problem?
node.js ssl nginx socket.io feathersjs
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm on the final stage with my node/feathers app. While I pushed an app at the server on which as deamon http is running nginx all is work great. When I used certbot for centos7 / nginx in order to SSL after reload page my socket.io can not load - error: secure error. I use public domain and for this domain created a cert.
I use below config on client side:
var socket = io({transports: ['websocket']});
var app = feathers()
.configure(feathers.hooks())
.configure(feathers.socketio(socket))
.configure(feathers.authentication({ storage: window.localStorage }))
app.js
// I added below code to end line of app.js file
const opts = {
key: fs.readFileSync('./privkey.pem'),
cert: fs.readFileSync('./cert.pem')
};
const server = https.createServer(opts, app);
app.setup(server);
module.exports = app;
Nginx:
server {
server_name subdomain www.subdomain;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:3030;
proxy_redirect off;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/subdomain/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/subdomain/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
}
server {
if ($host = subdomain) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name subdomain;
return 404; # managed by Certbot
}
where is the problem?
node.js ssl nginx socket.io feathersjs
I'm on the final stage with my node/feathers app. While I pushed an app at the server on which as deamon http is running nginx all is work great. When I used certbot for centos7 / nginx in order to SSL after reload page my socket.io can not load - error: secure error. I use public domain and for this domain created a cert.
I use below config on client side:
var socket = io({transports: ['websocket']});
var app = feathers()
.configure(feathers.hooks())
.configure(feathers.socketio(socket))
.configure(feathers.authentication({ storage: window.localStorage }))
app.js
// I added below code to end line of app.js file
const opts = {
key: fs.readFileSync('./privkey.pem'),
cert: fs.readFileSync('./cert.pem')
};
const server = https.createServer(opts, app);
app.setup(server);
module.exports = app;
Nginx:
server {
server_name subdomain www.subdomain;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:3030;
proxy_redirect off;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/subdomain/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/subdomain/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
}
server {
if ($host = subdomain) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name subdomain;
return 404; # managed by Certbot
}
where is the problem?
node.js ssl nginx socket.io feathersjs
node.js ssl nginx socket.io feathersjs
edited Nov 23 at 14:00
asked Nov 22 at 15:34
SeaDog
136214
136214
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434220%2fsocketio-cant-connect-through-https%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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