-
Notifications
You must be signed in to change notification settings - Fork 235
Open
Labels
Description
Hello, thanks for the amazing work here!
I'm using an API that requires a static IP, which the original caller can't have for now. That's why I'm creating a proxy using this package.
My script so far:
const express = require('express');
const proxy = require('express-http-proxy');
require('dotenv').config();
const api_domain = process.env.API_DOMAIN;
const proxy_ip = process.env.PROXY_IP;
const app = express();
app.use('/', proxy(`https://${api_domain}`, {
proxyReqOptDecorator: (proxyReqOpts, srcReq) => {
proxyReqOpts.headers['X-Forwarded-For'] = proxy_ip;
proxyReqOpts.headers['X-Real-IP'] = proxy_ip;
proxyReqOpts.headers['Client-IP'] = proxy_ip;
return proxyReqOpts;
}
}));
app.listen(3000, () => {
console.log('Proxy server listening on port 3000');
});But the API is seeing the original caller IP, not the proxy IP... Am I missing something?