【Vue】解决Vue项目做内网穿透后访问 Invalid Host header.

talk is cheap, show me the code.

devServer.disableHostCheck
boolean
When set to true this option bypasses host checking. THIS IS NOT RECOMMENDED as apps that do not check the host are vulnerable to DNS rebinding attacks.

https://webpack.js.org/configuration/dev-server/#devserverdisablehostcheck

  • vue-cli 2.x
    devServer: {
     disableHostCheck: true,
    }
    
  • vue-cli 3.x
    module.exports = {
      devServer: {
        disableHostCheck: true
      }
    }
    

参考

vue-cli配置参考
webpack documention

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章