Skip to content
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

devServer.proxy config does not accept object as described in options schema #1438

Closed
1 of 2 tasks
petterm opened this issue Jul 5, 2018 · 0 comments · Fixed by #1633
Closed
1 of 2 tasks

devServer.proxy config does not accept object as described in options schema #1438

petterm opened this issue Jul 5, 2018 · 0 comments · Fixed by #1633

Comments

@petterm
Copy link

petterm commented Jul 5, 2018

  • Operating System: macOS High Sierra 10.13.5
  • Node Version: 10.5.0
  • NPM Version: 6.1.0
  • webpack Version: 4.13.0
  • webpack-dev-server Version: 3.1.4
  • This is a bug
  • This is a modification request

Code

const webpack = require('webpack');
const path = require('path');

const configuration = {
    entry: path.resolve(__dirname, 'src/source.js'),
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'dist'),
    },
    mode: 'development',
    devServer: {
        contentBase: false,
        host: 'localhost',
        proxy: {
            context: () => true,
            target: 'http://localhost:8080',
        },
        port: 8000,
    },
};

module.exports = configuration;

Expected Behavior

Dev server should proxy request http://localhost:8000/test to http://localhost:8080/test.

Actual Behavior

Dev server does not recognise the proxy setup and returns Cannot GET /test

For Bugs; How can we reproduce the behavior?

If the proxy config is changed to an array with the current object as a single value it works as intended. The initial config should be valid though following the options schema.

Minimal repository to reproduce error: https://github.com/petterm/webpack-dev-server-test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Dashboard
Awaiting triage
Development

Successfully merging a pull request may close this issue.

2 participants