How to proxy requests to various types of HTTPS servers.
All options are provided by httpxy.
import { createProxyMiddleware } from 'http-proxy-middleware';
const apiProxy = createProxyMiddleware({
target: 'https://example.org',
changeOrigin: true,
});import * as fs from 'node:fs';
import { createProxyMiddleware } from 'http-proxy-middleware';
const apiProxy = createProxyMiddleware({
target: {
protocol: 'https:',
host: 'example.org',
port: 443,
pfx: fs.readFileSync('path/to/certificate.p12'),
passphrase: 'password',
},
changeOrigin: true,
});