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

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

Closed
1 of 2 tasks
markmarkyesyes opened this issue Aug 22, 2019 · 5 comments
Closed
1 of 2 tasks

Comments

@markmarkyesyes
Copy link

  • 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?

@markmarkyesyes markmarkyesyes changed the title PR #1696 Introduced a breaking change to v3.2.1 existing proxy bypass implementations. PR #1696 Introduced a breaking change in v3.3.0 to previous proxy bypass implementations. Aug 22, 2019
@alexander-akait
Copy link
Member

Please create minimum reproducible test repo

@markmarkyesyes
Copy link
Author

I will generalize some code from our environment this weekend and link it here. Thanks for the response.

@markmarkyesyes
Copy link
Author

work has gotten in the way, should be able to publish the repo by end of the week. apologies for the delay, thanks for keeping the issue open.

@alexander-akait
Copy link
Member

@markmarkyesyes can we close issue?

@alexander-akait
Copy link
Member

Feel free to feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants