Webpack dev server proxy failing
See original GitHub issueDescribe the bug
I am using storybook in full control mode and attempting to add a proxy to the webpack dev server for certain requests (as the backend API I’m querying is served off a different localhost
port). This is failing to work.
To Reproduce
- Setup storybook in full control mode
- Mutate
config
with adevServer.proxy
Code snippets
// Note: storybook is served on PORT 9001
module.exports = async ({ config, mode }) => {
config.devServer = {
proxy: [
{
context: ["/requests"],
target: "http://localhost"
}
]
};
return config;
};
System:
- MacOS
- Framework: react
- Version:
5.0.10
Apologies if this is a duplicate, however https://github.com/storybooks/storybook/issues/208 and the other issues I found didn’t seem to address this.
Any help would be much appreciated! 🙂
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
devServer proxy not working · Issue #793 · webpack ... - GitHub
devServer proxy doesn't proxy. If the current behavior is a bug, please provide the steps to reproduce. Client server running at localhost:8080 ...
Read more >vue.js - webpack dev-server: Avoid proxy errors on HTTP ...
This error message comes from node_modules/@vue/cli-service/lib/util/prepareProxy.js , which define a onError callback for node-http-proxy ;.
Read more >DevServer - webpack
Allows dev-server to register custom mime types. The object is passed to the underlying webpack-dev-middleware . See documentation for usage notes. webpack.
Read more >[SOLVED] Proxy stopped working - Help Requests
I updated most packages and proxy stopped working. Any ideas from looking at the below as to what could be the problem? Here,...
Read more >Development Server - SurviveJS
devServer.proxy - If you are using multiple servers, you have to proxy WDS to them. The proxy setting accepts an object of proxy...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@majames You can use the
middleware.js
feature storybook has: https://github.com/storybookjs/storybook/pull/435#issuecomment-366701274The feature still needs documentation. We could use your help with that.
We don’t use webpack-dev-server directly. We use the devMiddleware: https://github.com/webpack/webpack-dev-middleware
which doesn’t support proxies
Thanks for following up @shilman and @ndelangen! I’ll check it out and see whether it solves the problem for my use case! 🙂