LoginSignup
0
0

More than 3 years have passed since last update.

Netlify でレスポンスヘッダーをカスタマイズするときは大文字小文字に注意

Posted at

Netlify でカスタムヘッダーを出すには、_headers というファイルを使うか netlifuy.toml を使うかの2つの方法がありますが、どちらの方法をつかっても content-type ヘッダーの値をカスタマイズしたいときは、以下のように Sneak Case にしないと重複して出力されてしまいます。

正しい書き方

/xxx
  Content-Type: application/javascript; charset=UTF-8

間違った書き方

Content-Type が全部小文字。

/xxx
  content-type: application/javascript; charset=UTF-8

この場合、レスポンスヘッダーで以下のように2つの content-type が出力されてしまいます。

content-type: text/plain
content-type: application/javascript; charset=UTF-8

他のヘッダーも多分同じじゃないかなと。

0
0
0

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
0
0