vuejs / vue-cli

🛠️ webpack-based tooling for Vue.js Development
https://cli.vuejs.org/
MIT License
29.75k stars 6.33k forks source link

publicPath & sockjs-node/info #4190

Open newbie78 opened 5 years ago

newbie78 commented 5 years ago

Version

3.8.4

Environment info

  System:
    OS: Linux 4.9 Alpine Linux undefined
    CPU: (2) x64 Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz
  Binaries:
    Node: 11.5.0 - /usr/local/bin/node
    Yarn: 1.12.3 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: Not Found
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0 
    @vue/babel-plugin-transform-vue-jsx:  1.0.0 
    @vue/babel-preset-app:  3.8.0 
    @vue/babel-preset-jsx:  1.0.0 
    @vue/babel-sugar-functional-vue:  1.0.0 
    @vue/babel-sugar-inject-h:  1.0.0 
    @vue/babel-sugar-v-model:  1.0.0 
    @vue/babel-sugar-v-on:  1.0.0 
    @vue/cli-overlay:  3.8.0 
    @vue/cli-plugin-babel: ^3.8.0 => 3.8.0 
    @vue/cli-plugin-eslint: ^3.8.0 => 3.8.0 
    @vue/cli-service: ^3.8.0 => 3.8.4 
    @vue/cli-shared-utils:  3.8.0 
    @vue/component-compiler-utils:  2.6.0 
    @vue/eslint-config-airbnb: ^4.0.0 => 4.0.0 
    @vue/preload-webpack-plugin:  1.1.0 
    @vue/web-component-wrapper:  1.2.0 
    babel-helper-vue-jsx-merge-props:  2.0.3 
    eslint-plugin-vue: ^5.0.0 => 5.2.2 (4.7.1)
    vue: ^2.6.10 => 2.6.10 
    vue-eslint-parser:  5.0.0 (2.0.3)
    vue-hot-reload-api:  2.3.3 
    vue-loader:  15.7.0 
    vue-router: ^3.0.3 => 3.0.6 
    vue-router-user-roles: ^0.1.92 => 0.1.92 
    vue-style-loader:  4.1.2 
    vue-template-compiler: ^2.6.10 => 2.6.10 
    vue-template-es2015-compiler:  1.9.1 
    vuex: ^3.0.1 => 3.1.1 
    vuex-persistedstate: ^2.5.4 => 2.5.4 
  npmGlobalPackages:
    @vue/cli: 3.8.4

Steps to reproduce

yarn vue create .
change the vue.config.js
yarn serve

What is expected?

GET http://server.test/admin/sockjs-node/info?t=1561221882533 200

What is actually happening?

GET http://server.test/sockjs-node/info?t=1561221882533 502 (Bad Gateway)


vue.config.js

module.exports = {
  assetsDir: 'static/',
  publicPath: '/admin',
  productionSourceMap: false,
  devServer: {
    public: 'server.test',
    disableHostCheck: true,
  },
  pages: {
    admin: {
      entry: 'src/main.js',
      template: 'public/admin.html',
      filename: 'admin.html',
      title: 'Admin panel',
    },
  },
};

nginx proxy

  location /admin {
    include /etc/nginx/includes/proxy.conf;
    resolver 127.0.0.11 valid=10s;
    set $upstreamName my_server:8080;
    proxy_pass http://$upstreamName;
  }

how to add prefix to sockjs-node/info? tnx

newbie78 commented 5 years ago

maybe https://github.com/webpack/webpack-dev-server/issues/1809 is due to this

hrb981027 commented 2 years ago

@newbie78

devServer: {
  public: ' http://server.test',
  sockPath: '/admin/sockjs-node',
}

以上配置可以解决你的问题