[Reserved] vue-cli built environment, the agent server with nginx, display access: Invalid Host header

Source: https://blog.csdn.net/Cookysurongbin/article/details/86077241

vue-cli built environment, the agent server with nginx, display access: Invalid Host header

The investigation is because the new version of webpack-dev-server for security reasons, the default check hostname, if not the hostname in the configuration can not be accessed. Thus there are two methods, one is set to ignore host checks, one is disposed directly host your address.

1, host Close inspection

Can webpack.dev.conf.js file in the build directory, add disableHostCheck under devServer: true, skip the check


The same principle can be modified scripts command in package.json file: webpack-dev-server --disableHostCheck = true


2, arranged to your host, the host is your xxx.com, the same method of 2, modify the configuration file, and the script command

Modifications host index.js config file directory, the default contain localhost, modified to xxx.com
package.json the script statement: webpack-dev-server --host = xxx.com or --public = xxx.com

Guess you like

Origin www.cnblogs.com/wbl001/p/11388179.html