Created
April 18, 2014 15:52
-
-
Save awestendorf/11051086 to your computer and use it in GitHub Desktop.
SSL proxy for custom Tender domains
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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