Specify the status code by H2O

Specify the status code by H2O

re:dash見てたら302ステータスコードがめっちゃ多い!

本来301(恒久的な転送)であるべきなので301リダイレクトするようにh2oの設定を修正しました(301でリダイレクトしているだろうと勝手に思っていた...)。

こんな感じで指定できる。

"ghost.ponpokopon.me:443":
  listen:
    port: 443
    ...
  paths:
    "/":
      redirect:
        status: 301
        url: "https://blog.lorentzca.me/"

適用後curlを叩いて動作確認。

Before

$ curl --head http://ghost.ponpokopon.me/
HTTP/1.1 302 Redirected
...

After

$ curl --head http://ghost.ponpokopon.me/
HTTP/1.1 301 Redirected
...

Yay!

参考