Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yakbak('http://host.com/subdir') does not work #16

Open
mwolson opened this issue May 11, 2016 · 4 comments
Open

yakbak('http://host.com/subdir') does not work #16

mwolson opened this issue May 11, 2016 · 4 comments

Comments

@mwolson
Copy link

mwolson commented May 11, 2016

In this case:

yakbak('http://host.com/subdir', {dirname});

It seems like yakbak drops the '/subdir' part when it proxies requests and only sends 'http://host.com/'.

@commenthol
Copy link
Contributor

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)

@jeremyruppel
Copy link
Member

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().

@mwolson
Copy link
Author

mwolson commented May 14, 2016

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 [email protected]
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
#16 (comment)

@jeremyruppel
Copy link
Member

Hm, I'm not sure I'm quite understanding the setup here. Could you gist an example when you have a chance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants