Plug.Static is unable to serve files in production

what is the route you’re trying to reach? does it have a corresponding file in priv/static/waffle/uploads? please post the full error message if possible

Thank you for your quick response!

screenshots:



image

1 Like

Where are you putting your plug? I can only reproduce your error if I put the plug in my :browser pipeline in the router. If I put it in the endpoint (where it should go) then it works fine for me exactly the way you’ve written it.

Yes, I am putting it in my endpoint.ex.

image

This looks like it’s at the end of the file, after your router. Your router must be your last plug in the file :slightly_smiling_face:

1 Like

I have the same problem.

Hi,
So I’ve stumbled into this problem also. For some reason Elixir app, being in docker container, can not serve externally linked folder files as static files. It returns 404, so I assume it goes through usual router path, not static.

I tried different things, and at the end, I’ve just set up Nginx to serve static files from the uploads folder. Not a bad workaround though.

Hopefully someone finds the reason.