Fix agent API to accept protobuf content type

The :accepts plug in the agent_api pipeline was only allowing JSON,
which caused 406 errors when the agent sent protobuf requests.

Changes:
- Register application/x-protobuf MIME type in config
- Add protobuf to agent_api pipeline accepts list
- Agent can now successfully communicate using protobuf format
This commit is contained in:
Graham McIntire 2026-01-14 16:58:11 -06:00
parent 9a6369bd27
commit 749efe4798
No known key found for this signature in database
2 changed files with 6 additions and 1 deletions

View file

@ -22,6 +22,11 @@ config :logger, :default_formatter,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]
# Register protobuf MIME type for agent API
config :mime, :types, %{
"application/x-protobuf" => ["protobuf"]
}
# Filter sensitive parameters from logs
config :phoenix, :filter_parameters, ["password", "snmp_community", "secret", "token", "api_key"]

View file

@ -19,7 +19,7 @@ defmodule ToweropsWeb.Router do
end
pipeline :agent_api do
plug :accepts, ["json"]
plug :accepts, ["json", "protobuf"]
plug ToweropsWeb.Plugs.AgentAuth
end