[solution] ngrok, vue cli 出現 Invalid Host header

use ngrok for vue dev server or react dev server, connect host name to ngrok via browser, but get error message.

Invalid Host Origin header  

Solution

vue

edit vue.config.js

module.exports = {  
    devServer: {
        disableHostCheck: true,
    }
}

react

you can use ngrok command as below,

ngrok http --host-header=rewrite 8080  

reference

CaesarChi

Web developer, focus on website fullstack, special JavaScript, and love sharing developing experience and communicate with developers. http://about.me/clonn