Skip to content

fix(cli-service): restrict request headers of historyApiFallback in WebpackDevServer #6162

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

Merged
merged 1 commit into from
Jan 5, 2021

Conversation

githoniel
Copy link
Contributor

@githoniel githoniel commented Dec 22, 2020

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Underlying tools
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

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 to docisfy 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

Copy link
Collaborator

@fangbinwei fangbinwei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@haoqunjiang haoqunjiang merged commit a634400 into vuejs:dev Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants