Serving static files from a phoenix API

The default path for reading static files is priv/static, so you need to tweak it:

plug Plug.Static,
    # Note the root path.
    at: "/.well-known",
    from: {:my_app, "priv/certificates"},
    gzip: false,
    only: ~w(apple)

But I’d suggest following @silverdr advice and put the files in the usual location. Assuming the actual file is called apple, try this:

  • Put the file into static: /priv/static/.well-known/apple
  • Use “standard” Static plug config:
  plug Plug.Static,
    at: "/",
    from: :my_app,
    gzip: false,
    only: [".well-known"]