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:
parent
9a6369bd27
commit
749efe4798
2 changed files with 6 additions and 1 deletions
|
|
@ -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"]
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue