// 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}`
}
};
...
non-html requests are proxied to the target url.
The proxy middleware sets the request url as null if the bypass function returns a boolean, resulting in a 404 on page load.
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.
Please create minimum reproducible test repo
I will generalize some code from our environment this weekend and link it here. Thanks for the response.
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.
@markmarkyesyes can we close issue?
Feel free to feedback
Most helpful comment
I will generalize some code from our environment this weekend and link it here. Thanks for the response.