Phoenix Static Assets: TXT verification file


I need to serve a Static TXT file from my Phoenix app, for domain verification purposes:

• Google Search Console

• GoGetSSL certification

Both companies asked me to upload, each a different TXT file that would be verified on the root path of my domain.

Like so:

I downloaded the TXT file and have placed it into the web/static/assets folder.

But when trying to reach it using the browser I obviously get a no route found for GET

How can I make sure files within the web/static/assets folder are served by Phoenix?

You need to add that specific file to your Static Plug listing in your Endpoint. :slight_smile:


That was fast. Thank you very much. I’m reading the docs and will confirm I was able to make it in a few minutes :slight_smile:


As @OvermindDL1 said, add the following to your Plug.Static options in endpoint.ex:

plug Plug.Static,
  only: ~w(css fonts images js favicon.ico robots.txt 091823091231902322389.txt)

That’s what I did! Thank you :slight_smile:

1 Like