-
-
Notifications
You must be signed in to change notification settings - Fork 27k
when I yarn start the project will show me “proxy is not a function” #8550
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
Comments
I had the same issue, with version const { createProxyMiddleware } = require('http-proxy-middleware'); There's already a PR to update the documentation. |
Thanks @will-shaw I have a similar issue but am still getting the same error when I use
Any ideas on what could still be causing the issue? |
Thank you so much |
@adeedchoudhury Short of checking that you have module.exports = function(app) {
app.use(
'/api',
- proxy({
+ createProxyMiddleware({
target: 'http://localhost:5000',
changeOrigin: true,
})
} |
@will-shaw thanks! I forgot about renaming the function call. |
@will-shaw still facing the same error: proxy is not a function. Could you please help. I have done all the above-said things: const { proxy } = require('http-proxy-middleware'); |
@GautamUpreti123, use this:
|
Closing as we have a PR up to update the documentation. |
src/setupProxy.js
const proxy = require('http-proxy-middleware')
module.exports = function(app) {
app.use(proxy('/api',
{
target: "",
changeOrigin:true,
pathRewrite: {
"^/api": "/"
}
}))
}
The text was updated successfully, but these errors were encountered: