Skip to content

How to serve a specific static file (not CSS, JS or images) in Phoenix? #155

Description

@nelsonic

I would like a easy/simple way to serve a static file in a Phoenix App
e.g: when you need to verify a domain the registrar requires a .txt file.
This can sometimes be done at the DNS level. But other times it needs to be served by the Application.

My particular use case is the following: I want to serve a copy of the mix.lock file from the project
so that I can easily see exactly which version of a dependency is running.

In the past we have served an endpoint that displayed the Git version of the App
that we could then lookup on GitHub to determine exactly which version of the App was running for debugging purposes.

e.g: router.ex#L104-L106 and controllers/github_version_controller.ex

Problem is: I don't think the Git history is available on Fly.io (it wasn't on Heroku ...)
So I think the easiest thing is to serve a static file. 📁

Very grateful for any insight other people using Phoenix have on this. 💭 💬 🙏

Metadata

Metadata

Assignees

Labels

T25mTime Estimate 25 Minuteschorea tedious but necessary task often paying technical debtdiscussShare your constructive thoughts on how to make progress with this issueenhancementNew feature or enhancement of existing functionalitypriority-1Highest priority issue. This is costing us money every minute that passes.questionA question needs to be answered before progress can be made on this issueresearchResearch required; be specifictechnicalA technical issue that requires understanding of the code, infrastructure or dependencies

Type

No type

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions