Open mwolson opened 8 years ago
Proxying paths is not as trivial as proxying hosts. If you need path proxying you could do this with proxy-middleware e.g.
const app = express()
app.use('/subdir', yakbak('http://host.com', {dirname}))
app.use('/', proxyMiddleware('http://localhost:3000/subdir'))
app.listen(3000)
Yeah, yakbak isn't meant to do any sort of routing, it's a simple proxy from one host to another. Are you using yakbak with express by chance? Internally we use req.url
which express rewrites when you do app.use()
.
I'm using express. But I actually want the req.url rewriting since I'm proxying multiple services on different routes (namespaced by scenario, then service, then subservice) each with different tape directories on one express server. The problem is that one of those services has some leading path fragments which are present in dev but not production. So I'd like to have yakbak handle those leading fragments to simplify the rest of my setup.
On Sat, May 14, 2016 at 10:15 AM, Jeremy Ruppel notifications@github.com wrote:
Yeah, yakbak isn't meant to do any sort of routing, it's a simple proxy from one host to another. Are you using yakbak with express by chance? Internally we use req.url which express rewrites when you do app.use() http://expressjs.com/en/4x/api.html#req.originalUrl.
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/flickr/yakbak/issues/16#issuecomment-219232048
Hm, I'm not sure I'm quite understanding the setup here. Could you gist an example when you have a chance?
In this case:
It seems like yakbak drops the '/subdir' part when it proxies requests and only sends 'http://host.com/'.