Is it possible to run mendix locally using https?

3
Hi Probably a noob question, but is it easy to run-up the mendix local runtime to use https (test cert)? If so how? I'm playing around with some local browser / client side application dev. Mendix running in http is causing me obvious mixed content browser errors. I can't see how to set-up the "run locally" option to use SSL... I'm drawing a bit of blank in the forums as well.
asked
2 answers
8

Good question! Although the answer is pretty easy, it's hard to figure this one out if you've never worked with servers before.

Basically, the mendix runtime serves HTTP, normally on port 8080. Websites usually serve traffic on port 80, and offer an extra service on port 443. This 'extra service' is merely HTTP combined with an secure sockets layer (SSL).

The Mendix runtime doesn't offer any SSL encryption, nor should/would it, as it's traditionally seen as "heavy lifting" which is easily outsourced to another process, such as a webserver. In the mendixcloud, we use nginx to do exactly that: it adds SSL and tunnels the actual requests and responses to and from the runtime.

On your local machine, you'd have to do something similar. Under windows, most people run IIS, which offers SSL. Getting that up and running may or may not be your piece of cake (although the documentation and amount of resources should be plentiful).

Alternatively, you can either look at one of these alternatives or use a sandbox in the Mendix cloud.

answered
6

Hi

For anyone interested, I ended up fronting the local http service using a simple node.js script requiring the "http-proxy" npm package. This has so far worked really well. Fairly simple to set-up and recording here to close off the challenge I had. One of the reasons for wanting to get the application running locally with SSL was the need to address corporate lan based web services that expect / verify the use of SSL on the client. Anyway, here for those interested...

1) Install node.js 2) Install something with openssl command line. 3) Use openssl and create a dev ssl cert / key etc

Some resources I referred to... http://www.thegeekstuff.com/2009/07/linux-apache-mod-ssl-generate-key-csr-crt-file/ http://dst.lbl.gov/~boverhof/openssl_certs.html

4) install "http-proxy" via node.js npm manager. 5) Create this node.js script...

var http = require('http'), httpProxy = require('http-proxy'), fs = require('fs');

// Create the HTTPS proxy server in front of a HTTP server

console.log("Mendix (run local) HTTPS proxy service"); console.log(""); console.log("(from https://github.com/nodejitsu/node-http-proxy)"); console.log(""); console.log("Listening on https://localhost:8080/ and passing requests thru to http://localhost:9090/ (Mendix runtime)"); console.log("...Remember to set the server port on mendix app to use 9090 (See project configuration)");

httpProxy.createServer({ target: { host: 'localhost', port: 9090, }, ssl: { key: fs.readFileSync('./ssl/server.key', 'utf8'), cert: fs.readFileSync('./ssl/server.pem', 'utf8') } }).listen(8080);

6) run the script via node command (node myscript.js).

answered