Skip to content

PR #1696 Introduced a breaking change in v3.3.0 to previous proxy bypass implementations.  #2216

Description

@markmarkyesyes
  • Operating System: Mac OSX High Sierra
  • Node Version: 10.16.0
  • NPM Version: 6.9.0
  • webpack Version: 4.36.1
  • webpack-dev-server Version: 3.7.2
  • Browser: Chrome 74.0.3729.169
  • This is a bug
  • This is a modification request

Code

// webpack.config.js
...
config.devServer.proxy = {
    '**': {
        bypass(request) {
            if (request.headers.accept && request.headers.accept.includes('html')) {
                console.log('HTML', request.headers, request.url)
                return '/index.html';
            }
            console.log('API', request.headers, request.url)
            return false;
        },
        target: `http://localhost:${apiPort}`
    }
};
...

Expected Behavior

non-html requests are proxied to the target url.

Actual Behavior

The proxy middleware sets the request url as null if the bypass function returns a boolean, resulting in a 404 on page load.

For Bugs; How can we reproduce the behavior?

In PR #1696 , the actual behavior is listed as the previously intended behavior. This Issue is only to add a breaking change notice to the 3.3.0 release notes because previous consumers relied on an api which had its functionality changed in a non backwards compatible way.

For Features; What is the motivation and/or use-case for the feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions