Something wrong with Leaf when run on the server


I have a problem with Vapor template “Leaf”. it rendered html from the wrong leaf file.
such as Acronym.leaf is not called when I requested XXX Sex - Free Porn Videos at
But it rendered html from index.leaf instead.

Then ,I tried to stop running the project and restart my project again on the server.
This time when request XXX Sex - Free Porn Videos at, it work properly. Acronym.leaf is rendered.
But when I requested,it not rendered html from index.leaf, but Acronym.leaf instead.

Then, I tried to restart running my project on the server again.
This time , it render html from index.leaf when requested
but it doesn’t render html from acronym.leaf when requested XXX Sex - Free Porn Videos at

Appreciated if you could advise.

Best Regard,

@thammaporn I think this is related to Leaf template caching with non-unique keys · Issue #25 · vapor/template-kit · GitHub and Bug Running Leaf With --env production Enabled · Issue #117 · vapor/leaf · GitHub which looks like a bug in the way that template hashes are calculated. This should be fixed by the time Leaf is released and it may be worth looking in there for solutions.

Thanks for advice.
I found when I run the project manually using command > vapor run . Vapor render correct html page.

It seem the problem happened only when I run through supervisor.
But I don’t know how to fix it.

Is supervisor running the release build with production environment flag set?

The quick fix until the issue is resolved is to turn of caching in a custom LeafConfig

I checked my config conf file of supervisor.
It solved after delete the production environment like below.

command=vapor run -env=production
Change to
command=vapor run

However , Should we run as production environment?
Appreciated if you could advice.

Thank you.

Yes you should, since that’s the environment you’re in and things may be relying on it. Hopefully the fix is released soon, otherwise you could create a custom LeafConfig like the Leaf provider does and register that to disable caching. That will also fix the issue until the bug is fixed

Thanks for the solution.^^