fix(cli-service): restrict request headers of historyApiFallback in WebpackDevServer #6162
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
Other information:
To support history route mode, we current make
webpackDevServer
to redirects all requests to the entry html.All 404 requests will be redirected, including requests for non-existent js/css files. In the case of JS files, this will usually result in a JS syntax error while try to execute html content as javascript.
And if the user code needs to use 404 errors, for example,
docisfy
will try to load_sidebar.md
from multiple url one by one, all the way to the success one, this will lead todocisfy
never try to load next url because the first request will be either success or redirect to entry html, and will never return 404.this PR will restrict request headers of historyApiFallback only work with
[ 'text/html', 'application/xhtml+xml']
document is here https://github.com/bripkens/connect-history-api-fallback#htmlacceptheaders