Describe 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
config with a devServer.proxyCode snippets
// Note: storybook is served on PORT 9001
module.exports = async ({ config, mode }) => {
config.devServer = {
proxy: [
{
context: ["/requests"],
target: "http://localhost"
}
]
};
return config;
};
System:
5.0.10Apologies 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! 馃檪
Any update here? 馃檹
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
@majames Sorry for the late reply. Have you tried running with the --debug-webpack CLI option?
@majames You can use the middleware.js feature storybook has:
https://github.com/storybookjs/storybook/pull/435#issuecomment-366701274
The 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! 馃檪
Most helpful comment
@majames You can use the
middleware.jsfeature storybook has:https://github.com/storybookjs/storybook/pull/435#issuecomment-366701274
The 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