maz

maz

Hi all, in my umbrella app I’ve added this to my endpoint.ex file right after the “/” static plug:

  plug Plug.Static,
    at: "/.well-known",
    from: {:faithful_word_api, "priv/static/well-known"},
    gzip: false,
    content_types: %{"apple-app-site-association" => "application/json"}

serves fine with this url locally: http://localhost:4000/.well-known/apple-app-site-association

but after deploying with a multi-stage docker release on a digital ocean vps(with http-> https routing performed by Traefik, behind cloudflare), the path https://blahblahblah.app/well-known/apple-app-site-association results with this in the log:

faithful_word_umbrella    | 13:30:39.055 [error] #PID<0.6413.0> running FaithfulWordApi.Endpoint (connection #PID<0.6409.0>, stream id 3) terminated
faithful_word_umbrella    | Server: blahblahblah.app:80 (http)
faithful_word_umbrella    | Request: GET /.well-known/apple-app-site-association
faithful_word_umbrella    | ** (exit) an exception was raised:
faithful_word_umbrella    |     ** (Protocol.UndefinedError) protocol Phoenix.HTML.Safe not implemented for %{error: "unexpected"} of type Map. This protocol is implemented for the following type(s): Decimal, BitString, Atom, Float, Date, Time, Phoenix.HTML.Form, Integer, List, Tuple, DateTime, NaiveDateTime
faithful_word_umbrella    |         (phoenix_html) lib/phoenix_html/safe.ex:1: Phoenix.HTML.Safe.impl_for!/1
faithful_word_umbrella    |         (phoenix_html) lib/phoenix_html/safe.ex:15: Phoenix.HTML.Safe.to_iodata/1
faithful_word_umbrella    |         (phoenix) lib/phoenix/controller.ex:729: Phoenix.Controller.__put_render__/5
faithful_word_umbrella    |         (phoenix) lib/phoenix/endpoint/render_errors.ex:77: Phoenix.Endpoint.RenderErrors.instrument_render_and_send/5
faithful_word_umbrella    |         (phoenix) lib/phoenix/endpoint/render_errors.ex:62: Phoenix.Endpoint.RenderErrors.__catch__/5
faithful_word_umbrella    |         (phoenix) lib/phoenix/endpoint/cowboy2_handler.ex:42: Phoenix.Endpoint.Cowboy2Handler.init/4
faithful_word_umbrella    |         (cowboy) /app/deps/cowboy/src/cowboy_handler.erl:41: :cowboy_handler.execute/2
faithful_word_umbrella    |         (cowboy) /app/deps/cowboy/src/cowboy_stream_h.erl:296: :cowboy_stream_h.execute/3

I checked the paths also:

root@edge-faithful-word:~/faithfulword-phx/apps/faithful_word_api/priv/static/well-known# ll
total 16
drwxr-xr-x 2 root root   4096 Feb  9 12:59 ./
drwxr-xr-x 3 root root   4096 Feb  9 12:59 ../
-rw-r--r-- 1 root docker  255 Feb  9 12:59 apple-app-site-association
-rw-r--r-- 1 root docker  292 Feb  9 12:59 assetlinks.json

The only thing that looks bogus to me is the docker group ownership but not sure this matters because the permissions appear to be world readable.

Any other ideas? Deploying with Elixir 1.9.4(alpine). I happen to be using 1.10.0 in the dev env.

Showing Posts 1 to 3

josevalim

josevalim

Creator of Elixir

There are two errors happening. The request is failing but when rendering the error page, another error bubbles up. So my impression is that your 500 pages are also broken. I would suggest to set debug_errors: false in dev, check and fix the error pages, and then find out what is the actual underlying issue.

maz

maz OP

Thanks yeah the error-catching was fully broken. But I fixed it all and I was actually getting a 404 in prod(I believe because I was placing the files in priv/static, which dev could find but not prod .. could be a copydir issue while building the release docker image, not sure yet).

I’m getting the files now but I have to place them in assets/static and I manually added the literal names in the only: clause in the plug in endpoint.ex:

  plug Plug.Static,
    at: "/",
    from: :faithful_word_api,
    gzip: false,
    only: ~w(css fonts images js favicon.ico robots.txt apple-app-site-association assetlinks.json)

(not using .well-known at the moment, apparently you can optionally place them at webroot).
Thanks for putting me in the right direction.

maz

maz OP

I finally settled on this configuration:

  plug Plug.Static,
    at: "/",
    from: :faithful_word_api,
    gzip: false,
    only: ~w(css fonts images js favicon.ico robots.txt .well-known)

and I git -f force-added the files in assets/static/.well-known:

git add -f .well-known/

new file:   .well-known/apple-app-site-association
new file:   .well-known/assetlinks.json

works fine in both dev and prod.

when deployed, test with

— All posts loaded —

Where Next? Top

Trending in Questions Top

Hellowman
Hello everyone! I am new to coding with Elixir/Erlang. And i am looking for some utilities for fuzzing testing like AFL++. Does anyone ...
New
yarrichar
I’m very new to Elixir, so sorry if this is a silly question: I am wondering what happens to the mailbox of a process when the machine i...
New
pragdave
How do I tell Hologram not to escape HTML when substituting into templates? {Textile.render(@product.long_description)} escapes the HTM...
New
Fl4m3Ph03n1x
Background When trying to execute mix release on a Windows 11 machine for a Phoenix project I get the following error: * assembling mark...
New
mandar1045
I load tested a plain Phoenix chat app backed by Postgres with 100 million messages in it, everything on default settings, to see what br...
New
rlipscombe
I’d like to create a file with 600 permissions (rw-------), but there’s a race condition if I create it and then change the permissions. ...
New
saleyn
Is there a way to import record definitions in the iex shell for pretty printing (similar to the rr command in the erl shell)? This woul...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
261 13183 112
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
charlenopires
Hi everyone :waving_hand: I’ve been working on PhiaUI, an open-source UI component library for Phoenix LiveView, and I wanted to share i...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews