Support HEAD requests to feed endpoints
Original report in #973 (closed)
I tried to join to webcal/ics feed from thunderbird. a group-feed and a personal feed. both can not be joined. i got a 404 error in nginx log.
in mobilizon-log i found this one:
Jan 19 23:35:56 tu-events-01 mobilizon[254998]: 23:35:56.420 request_id=FsvQJ1Ls9hMggH4AAASB [info] HEAD /events/going/7rtoy7pGGdeprtDhZZsWeG/ics Jan 19 23:35:56 tu-events-01 mobilizon[254998]: 23:35:56.421 request_id=FsvQJ1Ls9hMggH4AAASB [debug] Processing with Mobilizon.Web.FeedController.going/2 Jan 19 23:35:56 tu-events-01 mobilizon[254998]: Parameters: %{"format" => "ics", "token" => "[FILTERED]"} Jan 19 23:35:56 tu-events-01 mobilizon[254998]: Pipelines: [:atom_and_ical] Jan 19 23:35:56 tu-events-01 mobilizon[254998]: 23:35:56.429 request_id=FsvQJ1Ls9hMggH4AAASB [debug] Could not render errors due to no supported media type in accept header. Jan 19 23:35:56 tu-events-01 mobilizon[254998]: Expected one of ["html", "json"] but got the following formats: Jan 19 23:35:56 tu-events-01 mobilizon[254998]: * "text/xml" with extensions: ["xml", "xsd", "rng"] Jan 19 23:35:56 tu-events-01 mobilizon[254998]: To accept custom formats, register them under the :mime library Jan 19 23:35:56 tu-events-01 mobilizon[254998]: in your config/config.exs file: Jan 19 23:35:56 tu-events-01 mobilizon[254998]: config :mime, :types, %{ Jan 19 23:35:56 tu-events-01 mobilizon[254998]: "application/xml" => ["xml"] Jan 19 23:35:56 tu-events-01 mobilizon[254998]: } Jan 19 23:35:56 tu-events-01 mobilizon[254998]: And then run `mix deps.clean --build mime` to force it to be recompiled. Jan 19 23:35:56 tu-events-01 mobilizon[254998]: . Errors will be rendered using the first accepted format "html" as fallback. Please customize the :accepts option under the :render_errors configuration in your e ndpoint if you want to support other formats or choose another fallback Jan 19 23:35:56 tu-events-01 mobilizon[254998]: 23:35:56.430 request_id=FsvQJ1Ls9hMggH4AAASB [warning] Template "406.html" not found Jan 19 23:35:56 tu-events-01 mobilizon[254998]: 23:35:56.432 request_id=FsvQJ1Ls9hMggH4AAASB [debug] QUERY OK source="admin_settings" db=1.1ms queue=0.8ms idle=1740.2ms Jan 19 23:35:56 tu-events-01 mobilizon[254998]: SELECT a0."id", a0."group", a0."name", a0."value", a0."inserted_at", a0."updated_at" FROM "admin_settings" AS a0 WHERE ((a0."group" = $1) AND (a0."name" = $2)) ["i nstance", "instance_name"] Jan 19 23:35:56 tu-events-01 mobilizon[254998]: 23:35:56.439 request_id=FsvQJ1Ls9hMggH4AAASB [debug] QUERY OK source="admin_settings" db=3.5ms queue=2.6ms idle=1742.5ms Jan 19 23:35:56 tu-events-01 mobilizon[254998]: SELECT a0."id", a0."group", a0."name", a0."value", a0."inserted_at", a0."updated_at" FROM "admin_settings" AS a0 WHERE ((a0."group" = $1) AND (a0."name" = $2)) ["i nstance", "contact"] Jan 19 23:35:56 tu-events-01 mobilizon[254998]: 23:35:56.442 request_id=FsvQJ1Ls9hMggH4AAASB [info] Sent 406 in 21ms Jan 19 23:35:56 tu-events-01 mobilizon[254998]: 23:35:56.442 request_id=FsvQJ1Ls9hMggH4AAASB [debug] Converted error Phoenix.NotAcceptableError to 406 response
I added
config :mime, :types, %{ "application/xml" => ["xml"] }
to my config, but i run release-installation. so no mix. mobilizon_ctl can't find a deps.clean
Is it possible, you dropped the normal xml-support? Because adding a calendar from thunderbird worked before update to 2.0.2.
In evolution i can join to personal and group webcal-feed. but only personal-feed is refreshable. I get this in my logs, refreshing the personal calendar.
Jan 19 23:38:33 tu-events-01 mobilizon[254998]: 23:38:33.970 request_id=FsvQTAGgM--MPTQAAAXR [info] GET /events/going/7rtoy7pGGdeprtDhZZsWeG/ics Jan 19 23:38:33 tu-events-01 mobilizon[254998]: 23:38:33.970 request_id=FsvQTAGgM--MPTQAAAXR [debug] Processing with Mobilizon.Web.FeedController.going/2 Jan 19 23:38:33 tu-events-01 mobilizon[254998]: Parameters: %{"format" => "ics", "token" => "[FILTERED]"} Jan 19 23:38:33 tu-events-01 mobilizon[254998]: Pipelines: [:atom_and_ical] Jan 19 23:38:33 tu-events-01 mobilizon[254998]: 23:38:33.974 [debug] QUERY OK source="feed_tokens" db=0.6ms queue=0.6ms idle=1281.8ms Jan 19 23:38:33 tu-events-01 mobilizon[254998]: SELECT f0."token", f0."actor_id", f0."user_id", f0."inserted_at" FROM "feed_tokens" AS f0 WHERE (f0."token" = $1) [<<82, 73, 72, 160, 162, 127, 76, 103, 160, 189, 184, 172, 151, 70, 238, 200>>] Jan 19 23:38:33 tu-events-01 mobilizon[254998]: 23:38:33.976 [debug] QUERY OK source="users" db=0.8ms queue=0.6ms idle=1283.8ms
Just tried it now... for getting logs... i can join and refresh group ics too in evolution. but thunderbird does not work.
This is probably because Thunderbird makes an HEAD
request before the GET
one, which we don't seem to support.