While trying out http-proxy with node.js, I have the following piece of code:
var httpProxy = require('http-proxy');
httpProxy.createServer(
require('proxy-by-url')({
'/AAA': { port: 80, host: 'myDomain.com' },
'/BBB': { port: 80, host: 'myDomain.com' }
})
).listen(8000);
Obviously all requests to http://localhost:8000/AAA and http://localhost:8000/BBB are proxied to http://myDomain.com
I'm trying to proxy the requests to http://localhost:8000/AAA to http://myDomain.com/AAA/rss.xml but cannot figure out how to set that up.
I tried with:
'/AAA': { port: 80, host: 'myDomain.com/AAA/rss.xml' }
but it is throwing exceptions.
'/AAA': { port: 80, host: 'myDomain.com', url: '/AAA/rss.xml' }
or
'/AAA': { port: 80, host: 'myDomain.com', path: '/AAA/rss.xml' }
are inefficiency.
Does someone has an idea on how to set that up?