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

memoizeHost option not working #479

Open
simondutertre opened this issue Feb 3, 2021 · 0 comments
Open

memoizeHost option not working #479

simondutertre opened this issue Feb 3, 2021 · 0 comments

Comments

@simondutertre
Copy link

simondutertre commented Feb 3, 2021

Hi,

There seems to be an issue with container.options.memoizedHost in resolveProxyHost.js line 8, not being set anywhere. ( while container.options.memoizeHost is correctly set )

See the following, that should not call getHost on every request right ?

const express = require('express')
const proxy = require('express-http-proxy')

const app1 = express()
const app2 = express()

function getHost() { 
  console.log("getting host");
  return "localhost:8002"
}

app1.use(proxy(getHost, {
  memoizeHost: true // explicitely pass param, but same behavior without
}))

app1.get('/')
app2.get('/', (req, res) => res.send('proxied'))

app1.listen(8001)
app2.listen(8002)

@monkpow
Can you confirm this ?

Thank you

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

1 participant