4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Phoenix のクライアントエラーの処理一覧、随時更新

Posted at

ホストしている Phoenix を Sentry で監視する中でみつけた、クライアントエラーとなった(不正アクセスへの)処理を以下にまとめます。

Plug.Static.InvalidPathError

Sentry の MESSAGE

(Plug.Static.InvalidPathError invalid path for static asset)

どのパスへのリクエストで発生したかが分からないメッセージですが、 https://github.com/elixir-plug/plug/pull/1098/files で改良されるようです。

起きる要因

パスに無効な文字列を含むリクエスト等で発生します。

再現方法

GET http://localhost:4000/assets/:

assetsPlug.Static で公開しているディレクトリ

レスポンスステータス: 400

Phoenix.NotAcceptableError

Sentry の MESSAGE

(Phoenix.NotAcceptableError no supported media type in accept header.

Expected one of ["html"] but got the following formats:

  * 

To accept custom formats, register them under the :mime library
in your config/config.exs file:

    config :mime, :types, %{
      "application/xml" => ["xml"]
    }

And then run `mix deps.clean --build mime` to force it to be recompiled.
)

起きる要因

サポートしない Accept ヘッダー でのリクエストにより発生します。今回のケースは Accept ヘッダーの 値が *

再現方法

サポートしない Accept ヘッダーを付与して

GET http://localhost:4000

レスポンスステータス: 406

4
2
1

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
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?