Skip to content

Instantly share code, notes, and snippets.

@brandontrowe
Created October 9, 2017 15:16
Show Gist options
  • Save brandontrowe/aac002e0902ea3ea0292291ca9ddf34c to your computer and use it in GitHub Desktop.
Save brandontrowe/aac002e0902ea3ea0292291ca9ddf34c to your computer and use it in GitHub Desktop.
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