LoginSignup
6
0

More than 1 year has passed since last update.

Vue.js で 'Invalid Host header' というエラーが出た時の対策

Last updated at Posted at 2021-11-17

ブラウザーに 'Invalid Host header' というエラーが出たときの対策です。
vue_aa.png

こちらの記事を参考にしました。
webpack-dev-serverで起動したアプリが「Invalid Host header」と表示される場合の対処法

サーバーの起動は次のコマンドで行います。

npm run serve

ポート 8080 にアクセスしてエラーが出ます。

#対策#
vue.config.js を編集します。

元のファイル

vue.config.js_org
module.exports = {
  transpileDependencies: ["vuetify"]
};

編集後のファイル

vue.config.js
module.exports = {
  transpileDependencies: ["vuetify"],
  devServer: {
    disableHostCheck: true
  }
};

サーバーを起動

npm run serve

8080 ポートにアクセスするとエラーは消えます。

6
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
0