strophe js not working after installing ssl certificate - javascript

I am developing a real time application for that i had installed openfire and using strophe js to integrate it on client side and everything works fine
but later on we had to integrate ssl certificate to website and after adding ssl certificate strophe stops working and giving error
i had added self attested certificates in openfire too but still no use

This looks like an issue with your web server config and not strophe. Speculating based on the little info I have about your configuration I would guess that openfire bosh config is listening on a port other than the default ssl 443 port.
You will either need to specify the port number openfire is listening on (adventurefriend.com:8443 or something) or use an http rewrite in your Apache config to rewrite requests with ^/http-bind to that port.

Related

Calling HTTP Node server inside HTTPS instance, SSL error

I'm trying to connect to a socket.io inside a Node server from a React client.
Both, the React client and the instance that the Node server is located (it's a microservice, there's also a Java container running there, both within a separated docker container) have https protocols. React client is inside a s3 bucket.
The thing is, Node server is HTTP only, has no certificate, and it's causing the request to the socket.io to fail.
The connection happens without any trouble inside de develop EC2, which is not HTTPS, also running normally with localhost.
Cors are enabled.
Is there a way, without having to turn Node serve into HTTPS, to make this requests not return SSL erros?
If not, what is the easiest way to turn it into a HTTPS server to run along with the Java server?
Thanks a lot!
A very short answer. Try using nginx as WebSocket proxy for you socket.io server.
Here are couple links:
nginx as WebSocket proxy
SSL configuration to make it an https
Socket.io official configuration

How to do a reverse proxy with node.js for a shiny app

EDIT
I think the problem might be that the WebSocket connection does not go through the proxy node.js. How to authorize the connection of the WebSocket?
I have a web app hosted on a nodeJS server. On the same vm I also have a shiny serveur hosting an app. I use node to redirect traffic to port 3838 (shiny) when a somes URL are requested.
I use this code on node :
app.use('/the-shiny-app', proxy({target: 'http://localhost:3838', changeOrigin: true}));
With this setting everything works fine on the shiny app when I go on mydomain/the-shiny-app/* except when I try to run code in a code box.
When I try to run code I get this error on the chrome console :
Connection closed. Info: {"type":"close","code":4503,"reason":"The application unexpectedly exited","wasClean":true}
An example of what I mean by code box :
if I do not use node.js and I redirect the traffic (on OS level) from port 80 directly to 3838 everything works fine.
sudo iptables -A PREROUTING -t nat -p tcp --dport 80 -j REDIRECT --to-ports 3838
I do not know exactly what kind of exchange is made between the browser and the shiny server when we run code, but maybe the protocol used is blocked by node.js.
I found the problem. As Antony Gibbs said you need to setup a WebSocket upgrade. I'm using http-proxy-middleware you cans find the doc here : https://github.com/chimurai/http-proxy-middleware

Node Server With NGINX

I have node js server that has a server which listens 8000 port and a socket.io connection working on that server. This socket connection creates a communication with a ReactJS app which is not a point of this question. So I have 2 project folders
1. project-server
2. project-web-react
Project server only answers socketio request and does not render a HTML or something else. It only works on terminal. I want to ask whether is it useful to encapsulate my project-server with Nginx? So the requests are handled by Nginx ? Or is it out of the Nginx's purpose?
I would never have an application server run directly connected through internet since there are always a bunch of unknowns with them (scaling, standard compliance etc), so I would recommend you to run a proxy like nginx in front of your app. This also makes it easy to add certificates and do load balancing / caching. It just adds flexibility and some security.

Setting laravel to work on a port number?

I am working with nodejs, expressjs, and socket.io I am triggering events on my web app with a mobile phone over the nodejs server.
The app is built on javascript but I am using laravel to store data into a database. I am new to nodejs so I am pretty sure if I wanted, I think I could cut out php and just use the whole app with nodejs, but I don't want to. I like laravel and php and it's alread setup, so let me explain my problem.
laravel is installed on my server http://example.com/public/ laravel's index.php is here. My routes for my data base resources are http://example.com/public/feeds. I can access this fine, but if I want to access my nodejs server I need to use http://example.com:3000 which obviously causes a problem.
The nodejs/expressjs files are inside http://example.com/public/MY-FILES-HERE but since the nodejs dispatches on http://example.com:3000 this throws my laravel routes off.
So what I am asking is how do I get it all to work well with eachother? I assume I need to setup a port somehow in laravel.
EDIT: So I am new to the port, and I didnt know there is already a default port set (80). My laravel install is on port 80, and inside here I can listen to calls from port 3000 using socket.io. I did not know that, so I have a page http://my-server-ip:3000/test which has one button and a script that sends the event to the nodejs server and that responds to my script which listens to events on port 3000 and executes a function. Cool stuff here, I hope I made sense I am very new.
Not quite sure what you mean by
this throws my laravel routes off
In a situation where you want to host multiple servers on port 80 from the same machine you might want to consider a reverse proxy. I recommend nginx for this.(http://www.cyberciti.biz/tips/using-nginx-as-reverse-proxy.html). Nginx will listen to port 80.
Then you setup a subdomain eg. node.example.com for the node.js service.
In the reverse proxy you listen for node.example.com on port 80 and direct that to port 3000. You set up Laravel/Apache? to listen on port 4000 and have nginx listen for www.example.com on port 80 and direct that to port 4000.
Is this what you are after?

Node.js on Azure Worker Role w/ SSL results in ERR_SSL_PROTOCOL_ERROR

I have a WorkerRole configured to start node.exe via the Runtime/EntryPoint/ProgramEntryPoint element in the csdef and have a HttpsIn EndPoint configured for https on port 443 w/ a valid certificate. I'm also setting the PORT environment variable in Runtime/Environment which is used by node to listen on for incoming requests.
When I start the service (either in local dev fabric or in Azure) and try to hit the service I get the following error:
SSL connection error
Unable to make a secure connection to the server. This may be a problem with the server, or it may be requiring a client authentication certificate that you don't have.
Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error.
I have verified that node.exe is indeed started when the service starts, and if I look up the local port in the Compute Emulator, usually something like:
http://localhost:444
I am able to successfully hit node directly with that using my browser. I am also able to hit node through Azure when SSL is not configured.
What am I missing? Thanks!
The issue was that I was using the http module instead of the https module when starting the web server in Node. Works once I started the https server using the ssl certificate.
I was following a guide for SSL w/ Node in a WebRole, which requires a different set up than SSL w/ Node in WorkerRole.

Categories