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

fix: should not proxy sockjs endpoint #4550

Merged
merged 1 commit into from Sep 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/@vue/cli-service/lib/util/prepareProxy.js
Expand Up @@ -44,10 +44,14 @@ module.exports = function prepareProxy (proxy, appPublicFolder) {
process.exit(1)
}

// Otherwise, if proxy is specified, we will let it handle any request except for files in the public folder.
// If proxy is specified, let it handle any request except for
// files in the public folder and requests to the WebpackDevServer socket endpoint.
// https://github.com/facebook/create-react-app/issues/6720
function mayProxy (pathname) {
const maybePublicPath = path.resolve(appPublicFolder, pathname.slice(1))
return !fs.existsSync(maybePublicPath)
const isPublicFileRequest = fs.existsSync(maybePublicPath)
const isWdsEndpointRequest = pathname.startsWith('/sockjs-node') // used by webpackHotDevClient
return !(isPublicFileRequest || isWdsEndpointRequest)
}

function createProxyEntry (target, usersOnProxyReq, context) {
Expand Down