Created
October 9, 2017 15:16
-
-
Save brandontrowe/aac002e0902ea3ea0292291ca9ddf34c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const express = require('express'); | |
const https = require('https'); | |
const fs = require('fs'); | |
const proxy = require('http-proxy-middleware'); | |
const app = express(); | |
app.use('/api1', proxy({ | |
target: 'https://example.com/one-api', | |
changeOrigin: true, | |
secure: true | |
})); | |
app.use('/api2', proxy({ | |
target: 'https://example.com/other-api', | |
changeOrigin: true, | |
secure: true | |
})); | |
https.createServer({ | |
key: fs.readFileSync( './localhost.key' ), | |
cert: fs.readFileSync( './localhost.cert' ), | |
requestCert: false, | |
rejectUnauthorized: false | |
}, app).listen(8443); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment