Skip to content

Instantly share code, notes, and snippets.

@awestendorf
Created April 18, 2014 15:52
Show Gist options
  • Save awestendorf/11051086 to your computer and use it in GitHub Desktop.
Save awestendorf/11051086 to your computer and use it in GitHub Desktop.
SSL proxy for custom Tender domains
// A simple node.js proxy which will force SSL encryption on support.yourcompany.com
// and forward through the secure tenderapp domain for your support account.
// npm install http-proxy
var fs = require('fs'),
http = require('http'),
httpProxy = require('http-proxy');
httpProxy.createServer({
ssl: {
key: fs.readFileSync('support.example.com.pem', 'utf8'),
cert: fs.readFileSync('support.example.com.pem', 'utf8')
},
target: 'https://example.tenderapp.com:443',
secure: true
}).listen(443);
// redirect all insecure traffic
http.createServer(function (req,res) {
res.statusCode = 301;
res.setHeader("Location", 'https://' + req.headers.host + req.url);
res.end();
}).listen(80);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment