-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Can't configure devServer proxy many entries #956
Comments
Linking our source is not a reproduction.
Meaning, what is happening? What's the exact undesirable behaviour we should see when reproducting this (assuming you provide a reproduction)? |
It's not easy to provide a reproduction, as you need an app with 2 reverse proxies defined. In my app, I have 1 reverse proxy configured for OpenID server ( Problem is that an indexed array is given to webpack devServer proxy option instead of an associative array. [{
target: 'http://localhost:9488',
pathRewrite: {'^/api/': '/api/'},
xfwd: true
}, {
target: 'http://localhost:9485',
pathRewrite: {'^/auth/': '/auth/'},
xfwd: true
}] but it should be: {
'/api': {
target: 'http://localhost:9488',
pathRewrite: {'^/api/': '/api/'},
xfwd: true
},
'/auth': {
target: 'http://localhost:9485',
pathRewrite: {'^/auth/': '/auth/'},
xfwd: true
}
} |
My exact undesirable behaviour is the following: both |
I see, now I got it. We'll look into it! |
I have the same problem. Even more, all my requests are proxied to the first defined proxy, including those paths are not matched. |
Can't reproduce - the multi proxy configs is working correctly in my local testing. This may have to do with your pathRewrite configuration (which doesn't seem to be doing anything). If you read the source code of webpack-dev-server, you'll notice it actually converts the object-based proxy options into an Array first. The internal format passed by vue-cli is correct. |
proxy 无效
|
want to proxy exclude some match path, how to configure in vue-cli 3.0 proxy: {
context: ['/example/**', '!/mock/**'],
target: 'http://localhost:8888',
changeOrigin: true
} proxy path include |
@zimplexing 这里的 proxy 好像并不支持 webpack-dev-server 的 devServer.proxy写法 |
you can write as follow |
If you are making a GET request, this might caued by browser cache, you should check the "Disable cache" box in 'Network 'tab. |
Version
3.0.0-beta.6
Reproduction link
vue-cli/packages/@vue/cli-service/lib/util/prepareProxy.js
Line 111 in 114e085
Steps to reproduce
Set up two proxies in devServer configuration
What is expected?
Both proxies should work.
What is actually happening?
It seems to configure the last entry only. In fact, it doesn't seem that devServer supports an array of proxy definition , an associative object should be given.
The text was updated successfully, but these errors were encountered: