I have my React webpack devserver set up like the following:
devServer: {
port: 3000,
historyApiFallback: true,
proxy: {
'/api': 'http://localhost:8080'
}
},
Now I also need to add disabledDotRule: true
to the historyApiFallback. Can someone help me to do that? If I try just to change it to
historyApiFallback: {
disableDotRule: true,
},
I get the following ECONNREFUSED error:
Error occurred while trying to proxy request /api/.../ from localhost:3000 to http://localhost:8080
I guess the problem is that historyApiFallback: true
is missing. How do I keep that while also adding disabledDotRule: true
?
Apologies, I misunderstood your question.
Could you try the following things and see if any work:
(1) Replace "http:localhost:8080" with "http://[::1]:8080" like so:
proxy:{
"/api":"http://[::1]:8080"
}
(2) Run the API on a different port like 8081 and see if you get the same error
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.